taxtank-core 0.28.34 → 0.28.36

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 (51) hide show
  1. package/bundles/taxtank-core.umd.js +1337 -1235
  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/interceptors/basiq-token.interceptor.js +1 -1
  5. package/esm2015/lib/models/bank/bank-connection.js +2 -2
  6. package/esm2015/lib/models/bank/bank-external-stats.js +7 -0
  7. package/esm2015/lib/models/bank/bank.js +6 -2
  8. package/esm2015/lib/models/bank/basiq/basiq-config.js +12 -0
  9. package/esm2015/lib/models/bank/basiq/basiq-connections-response.interface.js +2 -0
  10. package/esm2015/lib/models/bank/basiq/basiq-job-response.js +12 -0
  11. package/esm2015/lib/models/bank/basiq/basiq-job-step.js +12 -0
  12. package/esm2015/lib/models/bank/basiq/basiq-job.js +4 -0
  13. package/esm2015/lib/models/bank/basiq/basiq-token-response.interface.js +2 -0
  14. package/esm2015/lib/models/bank/basiq/basiq-token.js +13 -0
  15. package/esm2015/lib/models/bank/basiq/index.js +8 -0
  16. package/esm2015/lib/models/bank/index.js +14 -0
  17. package/esm2015/lib/models/event/app-event-type.enum.js +58 -57
  18. package/esm2015/lib/models/index.js +2 -1
  19. package/esm2015/lib/models/sole/sole-business-loss.js +7 -1
  20. package/esm2015/lib/services/http/bank/basiq/basiq-token.service.js +2 -2
  21. package/esm2015/lib/services/http/bank/basiq/basiq.service.js +51 -5
  22. package/esm2015/lib/services/http/user/user.service.js +8 -2
  23. package/esm2015/public-api.js +2 -15
  24. package/fesm2015/taxtank-core.js +855 -766
  25. package/fesm2015/taxtank-core.js.map +1 -1
  26. package/lib/db/Models/bank/bank.d.ts +4 -5
  27. package/lib/models/bank/bank-connection.d.ts +1 -1
  28. package/lib/models/bank/bank-external-stats.d.ts +11 -0
  29. package/lib/models/bank/bank.d.ts +2 -0
  30. package/lib/models/bank/{basiq-config.d.ts → basiq/basiq-config.d.ts} +0 -0
  31. package/lib/{services/http → models}/bank/basiq/basiq-connections-response.interface.d.ts +0 -0
  32. package/lib/models/bank/basiq/basiq-job-response.d.ts +5 -0
  33. package/lib/models/bank/basiq/basiq-job-step.d.ts +7 -0
  34. package/lib/models/bank/basiq/basiq-job.d.ts +3 -0
  35. package/lib/{services/http → models}/bank/basiq/basiq-token-response.interface.d.ts +0 -0
  36. package/lib/models/bank/{basiq-token.d.ts → basiq/basiq-token.d.ts} +0 -0
  37. package/lib/models/bank/basiq/index.d.ts +7 -0
  38. package/lib/models/bank/index.d.ts +13 -0
  39. package/lib/models/event/app-event-type.enum.d.ts +57 -56
  40. package/lib/models/index.d.ts +1 -0
  41. package/lib/models/sole/sole-business-loss.d.ts +2 -0
  42. package/lib/services/http/bank/basiq/basiq-token.service.d.ts +1 -1
  43. package/lib/services/http/bank/basiq/basiq.service.d.ts +17 -3
  44. package/package.json +1 -1
  45. package/public-api.d.ts +1 -14
  46. package/esm2015/lib/models/bank/basiq-config.js +0 -12
  47. package/esm2015/lib/models/bank/basiq-job.js +0 -4
  48. package/esm2015/lib/models/bank/basiq-token.js +0 -13
  49. package/esm2015/lib/services/http/bank/basiq/basiq-connections-response.interface.js +0 -2
  50. package/esm2015/lib/services/http/bank/basiq/basiq-token-response.interface.js +0 -2
  51. 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'), require('rxjs/operators'), 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', 'rxjs/operators', '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, global.rxjs.operators, 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, rxjs, operators, 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);
@@ -557,62 +557,63 @@
557
557
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONSENT_UPDATED"] = 5] = "BASIQ_CONSENT_UPDATED";
558
558
  AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONNECTION_UPDATED"] = 6] = "BASIQ_CONNECTION_UPDATED";
559
559
  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";
560
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_FINISHED"] = 8] = "BASIQ_LOGIN_FINISHED";
561
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 9] = "CLIENT_INVITE_ACCEPTED";
562
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 10] = "CLIENT_OPEN_CHAT";
563
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 11] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
564
+ AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 12] = "CURRENT_USER_GET_FAILED";
565
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 13] = "DEPRECIATION_DELETED";
566
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 14] = "DEPRECIATIONS_CREATED";
567
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_RECEIPT"] = 15] = "DEPRECIATION_UPDATED_WITH_RECEIPT";
568
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT"] = 16] = "DEPRECIATION_UPDATED_WITH_DELETED_RECEIPT";
569
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_CREATED"] = 17] = "DEPRECIATION_RECEIPT_CREATED";
570
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_RECEIPT_DELETED"] = 18] = "DEPRECIATION_RECEIPT_DELETED";
571
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 19] = "INCOME_SOURCES_CREATED";
572
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 20] = "INCOME_SOURCES_UPDATED";
573
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 21] = "INCOME_SOURCES_FORECASTS_CREATED";
574
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 22] = "INCOME_SOURCES_FORECASTS_UPDATED";
575
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 23] = "LOAN_UPDATED";
576
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 24] = "LOAN_PAYOUT_UPDATED";
577
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 25] = "MESSAGE_CREATED";
578
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 26] = "MESSAGE_FILE_CREATED";
579
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 27] = "MESSAGE_FILE_DELETED";
580
+ AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 28] = "NOTIFICATION_ADDED";
581
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 29] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
582
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 30] = "PROPERTY_UPDATED";
583
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 31] = "PROPERTY_UPDATED_WITH_DOCUMENT";
584
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 32] = "PROPERTY_DOCUMENT_ADDED";
585
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 33] = "PROPERTY_MOVEMENT_CREATED";
586
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 34] = "PROPERTY_MOVEMENT_UPDATED";
587
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 35] = "PROPERTY_MOVEMENT_DELETED";
588
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 36] = "PROPERTY_SHARE_UPDATED";
589
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 37] = "PROPERTY_SALE_ADDED";
590
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 38] = "PROPERTY_SALE_DELETED";
591
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 39] = "PROPERTY_SUBSCRIPTION_ADDED";
592
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 40] = "PROPERTY_SUBSCRIPTION_DELETED";
593
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 41] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
594
+ AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 42] = "SERVICE_SUBSCRIPTION_UPDATED";
595
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 43] = "SOLE_BUSINESS_CREATED";
596
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 44] = "SOLE_DEPRECIATION_METHOD_UPDATED";
597
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 45] = "SOLE_DETAILS_CREATED";
598
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 46] = "SOLE_DETAILS_UPDATED";
599
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 47] = "TAX_REVIEW_UPDATED";
600
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 48] = "TRANSACTION_CREATED";
601
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 49] = "TRANSACTION_DELETED";
602
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 50] = "TRANSACTION_UPDATED";
603
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_RECEIPT"] = 51] = "TRANSACTION_UPDATED_WITH_RECEIPT";
604
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED_WITH_DELETED_RECEIPT"] = 52] = "TRANSACTION_UPDATED_WITH_DELETED_RECEIPT";
605
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_CREATED"] = 53] = "TRANSACTION_RECEIPT_CREATED";
606
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_RECEIPT_DELETED"] = 54] = "TRANSACTION_RECEIPT_DELETED";
607
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 55] = "TRANSACTIONS_CREATED";
608
+ AppEventTypeEnum[AppEventTypeEnum["USER_UPDATED"] = 56] = "USER_UPDATED";
609
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 57] = "VEHICLE_CLAIM_UPDATED";
610
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 58] = "VEHICLE_CLAIM_CREATED";
611
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 59] = "VEHICLE_CLAIM_DETAILS_UPDATED";
612
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 60] = "VEHICLE_CLAIM_DETAILS_CREATED";
613
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 61] = "VEHICLE_LOGBOOK_CREATED";
614
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 62] = "VEHICLE_LOGBOOK_UPDATED";
615
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 63] = "VEHICLE_LOGBOOK_DELETED";
616
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 64] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
616
617
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
617
618
 
618
619
  var EventDispatcherService = /** @class */ (function () {
@@ -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,532 +1807,1021 @@
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", {
2033
- get: function () {
2034
- return this.sumBy('paymentDue');
2035
- },
2036
- enumerable: false,
2037
- configurable: true
2038
- });
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
- });
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);
2045
1858
  };
2046
- LoanPaymentCollection.prototype.getForCurrentYear = function () {
2047
- return this.getByFinYear(new FinancialYear());
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);
2048
1867
  };
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
1868
  /**
2058
- * Check if loan type is related to LoanVehicleTypeEnum
1869
+ * get collection filtered by property id
2059
1870
  */
2060
- Loan.prototype.isVehicle = function () {
2061
- return !this.bankAccount && this.type in exports.LoanVehicleTypeEnum;
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
+ }));
2062
1877
  };
2063
1878
  /**
2064
- * Get the last payment for passed financial year
2065
- * @param year financial year for filter
1879
+ * get collection filtered by properties ids
2066
1880
  */
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; }));
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
+ }));
2070
1887
  };
2071
1888
  /**
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
1889
+ * get collection of active bank accounts
2075
1890
  */
2076
- Loan.prototype.getInterest = function () {
2077
- return new LoanPaymentCollection(this.payments).paymentDue - this.amount;
1891
+ BankAccountCollection.prototype.getActiveBankAccounts = function () {
1892
+ return new BankAccountCollection(this.items.filter(function (bankAccount) {
1893
+ return bankAccount.isActive();
1894
+ }));
2078
1895
  };
2079
1896
  /**
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
1897
+ * get reduction of loan (reduction of principle) percentage
2083
1898
  */
2084
- Loan.prototype.getBalloonPayment = function () {
2085
- var lastPaymentDueAmount = new LoanPaymentCollection(this.payments).last.paymentDue;
2086
- return (lastPaymentDueAmount - this.repaymentAmount) > 0 ? lastPaymentDueAmount - this.repaymentAmount : 0;
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;
2087
1906
  };
2088
1907
  /**
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
1908
+ * Get collection of loan bank accounts
2092
1909
  */
2093
- Loan.prototype.getBalloonPaymentPercentage = function () {
2094
- return this.getBalloonPayment() / new LoanPaymentCollection(this.payments).paymentDue * 100;
1910
+ BankAccountCollection.prototype.getLoanAccounts = function () {
1911
+ return new BankAccountCollection(this.getByType(TYPE_LOAN));
2095
1912
  };
2096
- return Loan;
2097
- }(Loan$1));
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", {
1920
+ get: function () {
1921
+ return this.sumBy('currentBalance');
1922
+ },
1923
+ enumerable: false,
1924
+ configurable: true
1925
+ });
1926
+ /**
1927
+ * Get Collection of bank accounts with property tank type
1928
+ */
1929
+ BankAccountCollection.prototype.getPropertyBankAccounts = function () {
1930
+ return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isPropertyTank(); }));
1931
+ };
1932
+ /**
1933
+ * Get Collection of bank accounts with work tank type
1934
+ */
1935
+ BankAccountCollection.prototype.getWorkBankAccounts = function () {
1936
+ return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isWorkTank(); }));
1937
+ };
1938
+ /**
1939
+ * Get Collection of bank accounts by tank type
1940
+ */
1941
+ BankAccountCollection.prototype.getByTankType = function (tankType) {
1942
+ return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.tankType === tankType; }));
1943
+ };
1944
+ /**
1945
+ * Get list of all bank account properties
1946
+ */
1947
+ BankAccountCollection.prototype.getBankAccountPropertiesList = function () {
1948
+ return flatten__default["default"](this.items.map(function (bankAccount) {
1949
+ return bankAccount.bankAccountProperties;
1950
+ }));
1951
+ };
1952
+ /**
1953
+ * Get lis of unique properties from all bank accounts properties
1954
+ */
1955
+ BankAccountCollection.prototype.getProperties = function () {
1956
+ return uniqBy__default["default"](this.getBankAccountPropertiesList().map(function (bankAccountProperty) {
1957
+ return bankAccountProperty.property;
1958
+ }), 'id');
1959
+ };
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);
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);
2036
+ }
2037
+ return BasiqConfig;
2038
+ }());
2115
2039
 
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 = {}));
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
+ }());
2123
2049
 
2124
- var BankAccountBalance = /** @class */ (function (_super) {
2125
- __extends(BankAccountBalance, _super);
2126
- function BankAccountBalance() {
2050
+ var BasiqJob$1 = /** @class */ (function (_super) {
2051
+ __extends(BasiqJob, _super);
2052
+ function BasiqJob() {
2127
2053
  return _super !== null && _super.apply(this, arguments) || this;
2128
2054
  }
2129
- return BankAccountBalance;
2055
+ return BasiqJob;
2130
2056
  }(AbstractModel));
2131
2057
 
2132
- var BankAccountProperty$1 = /** @class */ (function (_super) {
2133
- __extends(BankAccountProperty, _super);
2134
- function BankAccountProperty() {
2058
+ var BasiqJob = /** @class */ (function (_super) {
2059
+ __extends(BasiqJob, _super);
2060
+ function BasiqJob() {
2135
2061
  return _super !== null && _super.apply(this, arguments) || this;
2136
2062
  }
2137
- return BankAccountProperty;
2138
- }(AbstractModel));
2063
+ return BasiqJob;
2064
+ }(BasiqJob$1));
2139
2065
 
2140
- var Property$1 = /** @class */ (function (_super) {
2141
- __extends(Property, _super);
2142
- function Property() {
2143
- return _super !== null && _super.apply(this, arguments) || this;
2066
+ var BasiqJobStep = /** @class */ (function () {
2067
+ function BasiqJobStep() {
2144
2068
  }
2145
- return Property;
2146
- }(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
+ }());
2147
2080
 
2148
- var PropertySubscription$1 = /** @class */ (function (_super) {
2149
- __extends(PropertySubscription, _super);
2150
- function PropertySubscription() {
2151
- return _super !== null && _super.apply(this, arguments) || this;
2081
+ var BasiqJobResponse = /** @class */ (function () {
2082
+ function BasiqJobResponse() {
2152
2083
  }
2153
- return PropertySubscription;
2154
- }(AbstractModel));
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);
2155
2092
 
2156
- var User$1 = /** @class */ (function (_super) {
2157
- __extends(User, _super);
2158
- function User() {
2159
- return _super !== null && _super.apply(this, arguments) || this;
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;
2160
2100
  }
2161
- return User;
2162
- }(AbstractModel));
2163
-
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 = {}));
2170
-
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 = {}));
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 = {}));
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 = {}));
2315
2229
 
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));
2328
-
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;
2339
2259
  };
2260
+ FinancialYear.toFinYear = function (date) {
2261
+ return date.getFullYear() + (date.getMonth() >= this.startMonthIndex ? 1 : 0);
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;
2472
- }(ServiceSubscriptionItem$1));
2473
- __decorate([
2474
- classTransformer.Type(function () { return ServicePrice; })
2475
- ], ServiceSubscriptionItem.prototype, "price", void 0);
2476
-
2477
- exports.SubscriptionTypeEnum = void 0;
2478
- (function (SubscriptionTypeEnum) {
2479
- SubscriptionTypeEnum[SubscriptionTypeEnum["WITHOUT_SUBSCRIPTION"] = 0] = "WITHOUT_SUBSCRIPTION";
2480
- SubscriptionTypeEnum[SubscriptionTypeEnum["INDIVIDUAL"] = 1] = "INDIVIDUAL";
2481
- SubscriptionTypeEnum[SubscriptionTypeEnum["INVESTOR"] = 2] = "INVESTOR";
2482
- SubscriptionTypeEnum[SubscriptionTypeEnum["INVESTOR_PLUS"] = 3] = "INVESTOR_PLUS";
2483
- })(exports.SubscriptionTypeEnum || (exports.SubscriptionTypeEnum = {}));
2484
-
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
+
2567
+ exports.AddressTypeEnum = void 0;
2568
+ (function (AddressTypeEnum) {
2569
+ AddressTypeEnum[AddressTypeEnum["STREET"] = 1] = "STREET";
2570
+ AddressTypeEnum[AddressTypeEnum["POSTAL"] = 2] = "POSTAL";
2571
+ })(exports.AddressTypeEnum || (exports.AddressTypeEnum = {}));
2572
+
2573
+ var Address = /** @class */ (function (_super) {
2574
+ __extends(Address, _super);
2575
+ function Address() {
2576
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2577
+ _this.type = exports.AddressTypeEnum.STREET;
2578
+ return _this;
2579
+ }
2580
+ Address.prototype.toString = function () {
2581
+ return [this.unitNumber, this.address, this.city, this.state, this.postcode].filter(Boolean).join(', ');
2582
+ };
2583
+ Object.defineProperty(Address.prototype, "name", {
2584
+ get: function () {
2585
+ return "" + (this.unitNumber ? this.unitNumber + '/' : '') + this.address;
2586
+ },
2587
+ enumerable: false,
2588
+ configurable: true
2589
+ });
2590
+ Object.defineProperty(Address.prototype, "nameLong", {
2591
+ get: function () {
2592
+ return this.name + ", " + this.city + ", " + this.state;
2593
+ },
2594
+ enumerable: false,
2595
+ configurable: true
2596
+ });
2597
+ return Address;
2598
+ }(Address$1));
2599
+ __decorate([
2600
+ classTransformer.Type((function () { return Country; }))
2601
+ ], Address.prototype, "country", void 0);
2602
+
2603
+ var _a$4;
2604
+ var USER_WORK_POSITION = (_a$4 = {},
2605
+ _a$4[exports.UserRolesEnum.EMPLOYEE] = 'Employee',
2606
+ _a$4[exports.UserRolesEnum.FIRM_MANAGER] = 'Manager',
2607
+ _a$4[exports.UserRolesEnum.FIRM_OWNER] = 'Firm Owner',
2608
+ _a$4);
2609
+
2610
+ var ClientDetails$1 = /** @class */ (function (_super) {
2611
+ __extends(ClientDetails, _super);
2612
+ function ClientDetails() {
2613
+ return _super !== null && _super.apply(this, arguments) || this;
2614
+ }
2615
+ return ClientDetails;
2616
+ }(AbstractModel));
2617
+
2618
+ var ClientDetails = /** @class */ (function (_super) {
2619
+ __extends(ClientDetails, _super);
2620
+ function ClientDetails() {
2621
+ return _super !== null && _super.apply(this, arguments) || this;
2622
+ }
2623
+ return ClientDetails;
2624
+ }(ClientDetails$1));
2625
+
2626
+ var EmployeeDetails$1 = /** @class */ (function (_super) {
2627
+ __extends(EmployeeDetails, _super);
2628
+ function EmployeeDetails() {
2629
+ return _super !== null && _super.apply(this, arguments) || this;
2630
+ }
2631
+ return EmployeeDetails;
2632
+ }(AbstractModel));
2633
+
2634
+ var Firm$1 = /** @class */ (function (_super) {
2635
+ __extends(Firm, _super);
2636
+ function Firm() {
2637
+ return _super !== null && _super.apply(this, arguments) || this;
2638
+ }
2639
+ return Firm;
2640
+ }(AbstractModel));
2641
+
2642
+ var Phone$1 = /** @class */ (function (_super) {
2643
+ __extends(Phone, _super);
2644
+ function Phone() {
2645
+ return _super !== null && _super.apply(this, arguments) || this;
2646
+ }
2647
+ return Phone;
2648
+ }(AbstractModel));
2649
+
2650
+ exports.PhoneTypeEnum = void 0;
2651
+ (function (PhoneTypeEnum) {
2652
+ PhoneTypeEnum[PhoneTypeEnum["MOBILE"] = 1] = "MOBILE";
2653
+ PhoneTypeEnum[PhoneTypeEnum["OFFICE"] = 2] = "OFFICE";
2654
+ })(exports.PhoneTypeEnum || (exports.PhoneTypeEnum = {}));
2655
+
2656
+ var Phone = /** @class */ (function (_super) {
2657
+ __extends(Phone, _super);
2658
+ function Phone() {
2659
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2660
+ _this.type = exports.PhoneTypeEnum.MOBILE;
2661
+ return _this;
2662
+ }
2663
+ Phone.prototype.toString = function () {
2664
+ return "+" + this.country.callingCode + " " + this.number;
2665
+ };
2666
+ return Phone;
2667
+ }(Phone$1));
2668
+
2669
+ var Firm = /** @class */ (function (_super) {
2670
+ __extends(Firm, _super);
2671
+ function Firm() {
2672
+ return _super !== null && _super.apply(this, arguments) || this;
2673
+ }
2674
+ /**
2675
+ * get firm photo link
2676
+ */
2677
+ Firm.prototype.getPhoto = function () {
2678
+ return this.photo;
2679
+ };
2680
+ /**
2681
+ * get firm initials
2682
+ */
2683
+ Firm.prototype.getPhotoPlaceholder = function () {
2684
+ return "" + this.name[0].toUpperCase() + this.name[1];
2685
+ };
2686
+ return Firm;
2687
+ }(Firm$1));
2688
+ __decorate([
2689
+ classTransformer.Type(function () { return User; })
2690
+ ], Firm.prototype, "owner", void 0);
2691
+ __decorate([
2692
+ classTransformer.Type(function () { return Address; })
2693
+ ], Firm.prototype, "address", void 0);
2694
+ __decorate([
2695
+ classTransformer.Type(function () { return Phone; })
2696
+ ], Firm.prototype, "phone", void 0);
2697
+
2698
+ var EmployeeDetails = /** @class */ (function (_super) {
2699
+ __extends(EmployeeDetails, _super);
2700
+ function EmployeeDetails() {
2701
+ return _super !== null && _super.apply(this, arguments) || this;
2702
+ }
2703
+ return EmployeeDetails;
2704
+ }(EmployeeDetails$1));
2705
+ __decorate([
2706
+ classTransformer.Type(function () { return Firm; })
2707
+ ], EmployeeDetails.prototype, "firm", void 0);
2708
+
2709
+ var ServiceSubscription$1 = /** @class */ (function (_super) {
2710
+ __extends(ServiceSubscription, _super);
2711
+ function ServiceSubscription() {
2712
+ return _super !== null && _super.apply(this, arguments) || this;
2713
+ }
2714
+ return ServiceSubscription;
2715
+ }(AbstractModel));
2716
+
2717
+ var ServiceSubscriptionItem$1 = /** @class */ (function (_super) {
2718
+ __extends(ServiceSubscriptionItem, _super);
2719
+ function ServiceSubscriptionItem() {
2720
+ return _super !== null && _super.apply(this, arguments) || this;
2721
+ }
2722
+ return ServiceSubscriptionItem;
2723
+ }(AbstractModel));
2724
+
2725
+ var ServicePrice$1 = /** @class */ (function (_super) {
2726
+ __extends(ServicePrice, _super);
2727
+ function ServicePrice() {
2728
+ return _super !== null && _super.apply(this, arguments) || this;
2729
+ }
2730
+ return ServicePrice;
2731
+ }(AbstractModel));
2732
+
2733
+ var ServiceProduct$1 = /** @class */ (function (_super) {
2734
+ __extends(ServiceProduct, _super);
2735
+ function ServiceProduct() {
2736
+ return _super !== null && _super.apply(this, arguments) || this;
2737
+ }
2738
+ return ServiceProduct;
2739
+ }(AbstractModel));
2740
+
2741
+ exports.ServiceProductStatusEnum = void 0;
2742
+ (function (ServiceProductStatusEnum) {
2743
+ ServiceProductStatusEnum[ServiceProductStatusEnum["ARCHIVED"] = 0] = "ARCHIVED";
2744
+ ServiceProductStatusEnum[ServiceProductStatusEnum["ACTIVE"] = 1] = "ACTIVE";
2745
+ })(exports.ServiceProductStatusEnum || (exports.ServiceProductStatusEnum = {}));
2746
+
2747
+ exports.ServiceProductIdEnum = void 0;
2748
+ (function (ServiceProductIdEnum) {
2749
+ ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK_OLD"] = 1] = "WORK_TANK_OLD";
2750
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_OLD"] = 2] = "PROPERTY_OLD";
2751
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_TANK"] = 3] = "PROPERTY_TANK";
2752
+ ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK"] = 4] = "WORK_TANK";
2753
+ ServiceProductIdEnum[ServiceProductIdEnum["PROPERTIES"] = 5] = "PROPERTIES";
2754
+ ServiceProductIdEnum[ServiceProductIdEnum["SOLE_TANK"] = 6] = "SOLE_TANK";
2755
+ })(exports.ServiceProductIdEnum || (exports.ServiceProductIdEnum = {}));
2756
+
2757
+ var ServiceProduct = /** @class */ (function (_super) {
2758
+ __extends(ServiceProduct, _super);
2759
+ function ServiceProduct() {
2760
+ return _super !== null && _super.apply(this, arguments) || this;
2761
+ }
2762
+ ServiceProduct.prototype.isProperties = function () {
2763
+ return [exports.ServiceProductIdEnum.PROPERTY_OLD, exports.ServiceProductIdEnum.PROPERTIES].includes(this.id);
2764
+ };
2765
+ ServiceProduct.prototype.isWorkTank = function () {
2766
+ return [exports.ServiceProductIdEnum.WORK_TANK_OLD, exports.ServiceProductIdEnum.WORK_TANK].includes(this.id);
2767
+ };
2768
+ ServiceProduct.prototype.isSoleTank = function () {
2769
+ return this.id === exports.ServiceProductIdEnum.SOLE_TANK;
2770
+ };
2771
+ ServiceProduct.prototype.isArchived = function () {
2772
+ return this.status === exports.ServiceProductStatusEnum.ARCHIVED;
2773
+ };
2774
+ return ServiceProduct;
2775
+ }(ServiceProduct$1));
2776
+
2777
+ var ServicePrice = /** @class */ (function (_super) {
2778
+ __extends(ServicePrice, _super);
2779
+ function ServicePrice() {
2780
+ return _super !== null && _super.apply(this, arguments) || this;
2781
+ }
2782
+ ServicePrice.prototype.toSubscriptionItem = function () {
2783
+ return classTransformer.plainToClass(ServiceSubscriptionItem, { price: this, quantity: this.product.minQty });
2784
+ };
2785
+ return ServicePrice;
2786
+ }(ServicePrice$1));
2787
+ __decorate([
2788
+ classTransformer.Type(function () { return ServiceProduct; })
2789
+ ], ServicePrice.prototype, "product", void 0);
2790
+
2791
+ /**
2792
+ * backend bd doesn't support dynamic prices, as far as we have just one product like that we keep it hardcoded
2793
+ */
2794
+ var PROPERTY_TANK_PRICE = 9;
2795
+ var ServiceSubscriptionItem = /** @class */ (function (_super) {
2796
+ __extends(ServiceSubscriptionItem, _super);
2797
+ function ServiceSubscriptionItem() {
2798
+ return _super !== null && _super.apply(this, arguments) || this;
2799
+ }
2800
+ Object.defineProperty(ServiceSubscriptionItem.prototype, "total", {
2801
+ get: function () {
2802
+ var price = this.price.amount * this.quantity;
2803
+ if (this.price.product.id === exports.ServiceProductIdEnum.PROPERTIES) {
2804
+ price += PROPERTY_TANK_PRICE;
2805
+ }
2806
+ return price;
2807
+ },
2808
+ enumerable: false,
2809
+ configurable: true
2810
+ });
2811
+ return ServiceSubscriptionItem;
2812
+ }(ServiceSubscriptionItem$1));
2813
+ __decorate([
2814
+ classTransformer.Type(function () { return ServicePrice; })
2815
+ ], ServiceSubscriptionItem.prototype, "price", void 0);
2816
+
2817
+ exports.SubscriptionTypeEnum = void 0;
2818
+ (function (SubscriptionTypeEnum) {
2819
+ SubscriptionTypeEnum[SubscriptionTypeEnum["WITHOUT_SUBSCRIPTION"] = 0] = "WITHOUT_SUBSCRIPTION";
2820
+ SubscriptionTypeEnum[SubscriptionTypeEnum["INDIVIDUAL"] = 1] = "INDIVIDUAL";
2821
+ SubscriptionTypeEnum[SubscriptionTypeEnum["INVESTOR"] = 2] = "INVESTOR";
2822
+ SubscriptionTypeEnum[SubscriptionTypeEnum["INVESTOR_PLUS"] = 3] = "INVESTOR_PLUS";
2823
+ })(exports.SubscriptionTypeEnum || (exports.SubscriptionTypeEnum = {}));
2824
+
2485
2825
  var _a$3;
2486
2826
  var SUBSCRIPTION_TITLE = (_a$3 = {},
2487
2827
  _a$3[exports.SubscriptionTypeEnum.WITHOUT_SUBSCRIPTION] = 'Without subscription',
@@ -2777,7 +3117,10 @@
2777
3117
  var SoleBusinessLoss = /** @class */ (function (_super) {
2778
3118
  __extends(SoleBusinessLoss, _super);
2779
3119
  function SoleBusinessLoss() {
2780
- return _super !== null && _super.apply(this, arguments) || this;
3120
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
3121
+ _this.openBalance = 0;
3122
+ _this.financialYear = new FinancialYear().year;
3123
+ return _this;
2781
3124
  }
2782
3125
  Object.defineProperty(SoleBusinessLoss.prototype, "hasOffset", {
2783
3126
  get: function () {
@@ -5688,74 +6031,6 @@
5688
6031
  return BankConnection;
5689
6032
  }(AbstractModel));
5690
6033
 
5691
- var BasiqJob$1 = /** @class */ (function (_super) {
5692
- __extends(BasiqJob, _super);
5693
- function BasiqJob() {
5694
- return _super !== null && _super.apply(this, arguments) || this;
5695
- }
5696
- return BasiqJob;
5697
- }(AbstractModel));
5698
-
5699
- var BasiqJob = /** @class */ (function (_super) {
5700
- __extends(BasiqJob, _super);
5701
- function BasiqJob() {
5702
- return _super !== null && _super.apply(this, arguments) || this;
5703
- }
5704
- return BasiqJob;
5705
- }(BasiqJob$1));
5706
-
5707
- var Bank$1 = /** @class */ (function (_super) {
5708
- __extends(Bank, _super);
5709
- function Bank() {
5710
- return _super !== null && _super.apply(this, arguments) || this;
5711
- }
5712
- return Bank;
5713
- }(AbstractModel));
5714
-
5715
- var BankPopularEnum;
5716
- (function (BankPopularEnum) {
5717
- BankPopularEnum["BANKWEST"] = "Bank of Western Australia trading as BankWest";
5718
- BankPopularEnum["ANZ"] = "Australia and New Zealand Banking Group Limited";
5719
- BankPopularEnum["CBA"] = "Commonwealth Bank Australia";
5720
- BankPopularEnum["WESTPAC"] = "Westpac Banking Corporation";
5721
- BankPopularEnum["BENDIGO"] = "Bendigo and Adelaide Bank Limited";
5722
- BankPopularEnum["ING_DIRECT"] = "ING Bank (Australia) Limited (trading as ING Direct)";
5723
- BankPopularEnum["ST_GEORGE"] = "St. George Bank (a subsidiary of Westpac)";
5724
- BankPopularEnum["SUNCORP"] = "Suncorp-Metway Limited";
5725
- BankPopularEnum["CITIBANK"] = "Citibank";
5726
- BankPopularEnum["BOQ"] = "Bank of Queensland Limited";
5727
- })(BankPopularEnum || (BankPopularEnum = {}));
5728
-
5729
- var Bank = /** @class */ (function (_super) {
5730
- __extends(Bank, _super);
5731
- function Bank() {
5732
- return _super !== null && _super.apply(this, arguments) || this;
5733
- }
5734
- Bank.prototype.getPhotoPlaceholder = function () {
5735
- return this.name[0] + this.name[1];
5736
- };
5737
- Bank.prototype.getPhoto = function () {
5738
- if (!this.logo) {
5739
- return null;
5740
- }
5741
- return this.logo.includes('http') ? "" + this.logo : localStorage.getItem('api_uri') + "/" + this.logo;
5742
- };
5743
- return Bank;
5744
- }(Bank$1));
5745
- __decorate([
5746
- classTransformer.Transform(function (_a) {
5747
- var value = _a.value;
5748
- return value ? value.replace(' ', '%20') : null;
5749
- })
5750
- ], Bank.prototype, "logo", void 0);
5751
- __decorate([
5752
- classTransformer.Transform(function (_a) {
5753
- var obj = _a.obj;
5754
- return Object.values(BankPopularEnum).includes(obj.name);
5755
- }),
5756
- classTransformer.Expose()
5757
- ], Bank.prototype, "isPopular", void 0);
5758
-
5759
6034
  exports.BankConnectionStatusEnum = void 0;
5760
6035
  (function (BankConnectionStatusEnum) {
5761
6036
  BankConnectionStatusEnum[BankConnectionStatusEnum["PENDING"] = 1] = "PENDING";
@@ -5946,236 +6221,308 @@
5946
6221
  /**
5947
6222
  * Check if passed user id is owner of bank account
5948
6223
  */
5949
- BankAccount.prototype.isOwner = function (userId) {
5950
- return this.bankConnection.user.id === userId;
5951
- };
5952
- return BankAccount;
5953
- }(BankAccount$1));
5954
- __decorate([
5955
- classTransformer.Type(function () { return BankAccountProperty; })
5956
- ], BankAccount.prototype, "bankAccountProperties", void 0);
5957
- __decorate([
5958
- classTransformer.Type(function () { return SoleBusinessAllocation; })
5959
- ], BankAccount.prototype, "businessAllocations", void 0);
5960
- __decorate([
5961
- classTransformer.Type(function () { return BankAccountBalance; })
5962
- ], BankAccount.prototype, "balances", void 0);
5963
- __decorate([
5964
- classTransformer.Type(function () { return Loan; })
5965
- ], BankAccount.prototype, "loan", void 0);
5966
- __decorate([
5967
- classTransformer.Type(function () { return BankConnection; })
5968
- ], BankAccount.prototype, "bankConnection", void 0);
5969
- __decorate([
5970
- classTransformer.Transform(function (_b) {
5971
- var value = _b.value;
5972
- return value === 4 ? exports.BankAccountTypeEnum.LOAN : value;
5973
- })
5974
- ], BankAccount.prototype, "type", void 0);
5975
-
5976
- var TYPE_LOAN = [
5977
- exports.BankAccountTypeEnum.CREDIT_CARD,
5978
- exports.BankAccountTypeEnum.LOAN
5979
- ];
5980
-
5981
- /**
5982
- * Collection of bank accounts.
5983
- */
5984
- var BankAccountCollection = /** @class */ (function (_super) {
5985
- __extends(BankAccountCollection, _super);
5986
- function BankAccountCollection() {
5987
- return _super !== null && _super.apply(this, arguments) || this;
5988
- }
5989
- /**
5990
- * get list of bank accounts with passed types
5991
- */
5992
- BankAccountCollection.prototype.getByType = function (types, isExclude) {
5993
- if (isExclude === void 0) { isExclude = false; }
5994
- // get types always as array (if only one passed)
5995
- var typesArray = concat__default["default"](types);
5996
- return this.items.filter(function (bankAccount) {
5997
- if (isExclude) {
5998
- return !typesArray.includes(bankAccount.type);
5999
- }
6000
- return typesArray.includes(bankAccount.type);
6001
- });
6002
- };
6003
- /**
6004
- * get amount of initial loans
6005
- */
6006
- BankAccountCollection.prototype.getInitialLoanAmount = function () {
6007
- return this.getByType(TYPE_LOAN)
6008
- .reduce(function (sum, bankAccount) {
6009
- return sum += bankAccount.balances.length ? bankAccount.getOpeningBalance() : 0;
6010
- }, 0);
6011
- };
6012
- /**
6013
- * get amount of current loans
6014
- */
6015
- BankAccountCollection.prototype.getCurrentLoanAmount = function () {
6016
- return this.getByType(TYPE_LOAN)
6017
- .reduce(function (sum, bankAccount) {
6018
- return sum += bankAccount.currentBalance;
6019
- }, 0);
6020
- };
6021
- /**
6022
- * get collection filtered by property id
6023
- */
6024
- BankAccountCollection.prototype.getByPropertyId = function (id) {
6025
- return new BankAccountCollection(this.items.filter(function (bankAccount) {
6026
- return bankAccount.bankAccountProperties.find(function (bankAccountProperty) {
6027
- return bankAccountProperty.property.id === id;
6028
- });
6029
- }));
6224
+ BankAccount.prototype.isOwner = function (userId) {
6225
+ return this.bankConnection.user.id === userId;
6030
6226
  };
6227
+ return BankAccount;
6228
+ }(BankAccount$1));
6229
+ __decorate([
6230
+ classTransformer.Type(function () { return BankAccountProperty; })
6231
+ ], BankAccount.prototype, "bankAccountProperties", void 0);
6232
+ __decorate([
6233
+ classTransformer.Type(function () { return SoleBusinessAllocation; })
6234
+ ], BankAccount.prototype, "businessAllocations", void 0);
6235
+ __decorate([
6236
+ classTransformer.Type(function () { return BankAccountBalance; })
6237
+ ], BankAccount.prototype, "balances", void 0);
6238
+ __decorate([
6239
+ classTransformer.Type(function () { return Loan; })
6240
+ ], BankAccount.prototype, "loan", void 0);
6241
+ __decorate([
6242
+ classTransformer.Type(function () { return BankConnection; })
6243
+ ], BankAccount.prototype, "bankConnection", void 0);
6244
+ __decorate([
6245
+ classTransformer.Transform(function (_b) {
6246
+ var value = _b.value;
6247
+ return value === 4 ? exports.BankAccountTypeEnum.LOAN : value;
6248
+ })
6249
+ ], BankAccount.prototype, "type", void 0);
6250
+
6251
+ /**
6252
+ * bank account collection UI class with frontend specific data
6253
+ */
6254
+ var BankAccountChartData = /** @class */ (function () {
6255
+ function BankAccountChartData(bankAccounts) {
6256
+ this.bankAccounts = bankAccounts;
6257
+ }
6031
6258
  /**
6032
- * get collection filtered by properties ids
6259
+ * set value of pie chart data
6033
6260
  */
6034
- BankAccountCollection.prototype.getByPropertiesIds = function (ids) {
6035
- return new BankAccountCollection(this.items.filter(function (bankAccount) {
6036
- return bankAccount.bankAccountProperties.find(function (bankAccountProperty) {
6037
- return ids.includes(bankAccountProperty.property.id);
6038
- });
6039
- }));
6261
+ BankAccountChartData.prototype.getBalancePieChartData = function () {
6262
+ return this.bankAccounts.map(function (bankAccount) {
6263
+ return {
6264
+ name: bankAccount.accountName,
6265
+ data: Math.abs(bankAccount.currentBalance)
6266
+ };
6267
+ });
6040
6268
  };
6041
6269
  /**
6042
- * get collection of active bank accounts
6270
+ * set value of bar chart data
6043
6271
  */
6044
- BankAccountCollection.prototype.getActiveBankAccounts = function () {
6045
- return new BankAccountCollection(this.items.filter(function (bankAccount) {
6046
- return bankAccount.isActive();
6047
- }));
6272
+ BankAccountChartData.prototype.getBalanceBarChartData = function () {
6273
+ return [{
6274
+ name: 'Balance',
6275
+ data: this.bankAccounts.map(function (bankAccount) {
6276
+ return {
6277
+ label: bankAccount.accountName,
6278
+ value: bankAccount.currentBalance
6279
+ };
6280
+ })
6281
+ }];
6048
6282
  };
6283
+ return BankAccountChartData;
6284
+ }());
6285
+
6286
+ /**
6287
+ * Const which contains array of bank account types
6288
+ */
6289
+ var BANK_ACCOUNT_TYPES = [
6290
+ { key: exports.BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts' },
6291
+ { key: exports.BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts' },
6292
+ { key: exports.BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts' },
6293
+ { key: exports.BankAccountTypeEnum.LOAN, value: 'Loan Accounts' },
6294
+ { key: exports.BankAccountTypeEnum.OFFSET, value: 'Offset' },
6295
+ { key: exports.BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts' },
6296
+ { key: exports.BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts' },
6297
+ ];
6298
+
6299
+ /**
6300
+ * Login data object for basiq banks
6301
+ */
6302
+ var BankLoginData = /** @class */ (function () {
6303
+ function BankLoginData() {
6304
+ }
6305
+ return BankLoginData;
6306
+ }());
6307
+
6308
+ /**
6309
+ * enum with months indexes.
6310
+ * item value match with js Date month index from 0 to 11
6311
+ * Order of items match with financial year months order
6312
+ */
6313
+ exports.MonthNumberEnum = void 0;
6314
+ (function (MonthNumberEnum) {
6315
+ MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
6316
+ MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
6317
+ MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
6318
+ MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
6319
+ MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
6320
+ MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
6321
+ MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
6322
+ MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
6323
+ MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
6324
+ MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
6325
+ MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
6326
+ MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
6327
+ })(exports.MonthNumberEnum || (exports.MonthNumberEnum = {}));
6328
+
6329
+ /**
6330
+ * @TODO move to pipe/translation
6331
+ * enum with months short names.
6332
+ * Order of items match with financial year months order
6333
+ */
6334
+ exports.MonthNameShortEnum = void 0;
6335
+ (function (MonthNameShortEnum) {
6336
+ MonthNameShortEnum["JULY"] = "Jul";
6337
+ MonthNameShortEnum["AUGUST"] = "Aug";
6338
+ MonthNameShortEnum["SEPTEMBER"] = "Sep";
6339
+ MonthNameShortEnum["OCTOBER"] = "Oct";
6340
+ MonthNameShortEnum["NOVEMBER"] = "Nov";
6341
+ MonthNameShortEnum["DECEMBER"] = "Dec";
6342
+ MonthNameShortEnum["JANUARY"] = "Jan";
6343
+ MonthNameShortEnum["FEBRUARY"] = "Feb";
6344
+ MonthNameShortEnum["MARCH"] = "Mar";
6345
+ MonthNameShortEnum["APRIL"] = "Apr";
6346
+ MonthNameShortEnum["MAY"] = "May";
6347
+ MonthNameShortEnum["JUNE"] = "Jun";
6348
+ })(exports.MonthNameShortEnum || (exports.MonthNameShortEnum = {}));
6349
+
6350
+ /**
6351
+ * bank transactions collection UI class with frontend specific data
6352
+ */
6353
+ var BankTransactionChartData = /** @class */ (function () {
6354
+ function BankTransactionChartData(bankTransactions) {
6355
+ this.bankTransactions = bankTransactions;
6356
+ }
6049
6357
  /**
6050
- * get reduction of loan (reduction of principle) percentage
6358
+ * get value of bar chart data
6051
6359
  */
6052
- BankAccountCollection.prototype.getPrincipleReductionPercent = function () {
6053
- var initialLoans = this.getInitialLoanAmount();
6054
- var currentLoans = this.getCurrentLoanAmount();
6055
- if (!initialLoans) {
6056
- return 0;
6360
+ BankTransactionChartData.prototype.getCashInOutBarChartData = function (months) {
6361
+ var chartData = this.calculateCashInOutBarChartData();
6362
+ if (!months) {
6363
+ return chartData;
6057
6364
  }
6058
- return (initialLoans - currentLoans) / initialLoans * 100;
6365
+ return this.filterChartDataByMonths(months, chartData);
6059
6366
  };
6060
6367
  /**
6061
- * Get collection of loan bank accounts
6368
+ * get value of line chart data
6062
6369
  */
6063
- BankAccountCollection.prototype.getLoanAccounts = function () {
6064
- return new BankAccountCollection(this.getByType(TYPE_LOAN));
6065
- };
6066
- BankAccountCollection.prototype.getSavingsAccounts = function () {
6067
- return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
6068
- };
6069
- BankAccountCollection.prototype.getOpeningBalance = function () {
6070
- return this.items.reduce(function (sum, bankAccount) { return sum + bankAccount.getOpeningBalance(); }, 0);
6370
+ BankTransactionChartData.prototype.getBalanceLineChartData = function (months) {
6371
+ var chartData = this.calculateBalanceLineChartData();
6372
+ if (!months) {
6373
+ return chartData;
6374
+ }
6375
+ return this.filterChartDataByMonths(months, chartData);
6071
6376
  };
6072
- Object.defineProperty(BankAccountCollection.prototype, "currentBalance", {
6073
- get: function () {
6074
- return this.sumBy('currentBalance');
6075
- },
6076
- enumerable: false,
6077
- configurable: true
6078
- });
6079
6377
  /**
6080
- * Get Collection of bank accounts with property tank type
6378
+ * set bar chart data
6081
6379
  */
6082
- BankAccountCollection.prototype.getPropertyBankAccounts = function () {
6083
- return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isPropertyTank(); }));
6380
+ BankTransactionChartData.prototype.calculateCashInOutBarChartData = function () {
6381
+ var chartData = [{
6382
+ name: 'Cash In',
6383
+ data: []
6384
+ }, {
6385
+ name: 'Cash Out',
6386
+ data: []
6387
+ }];
6388
+ var _loop_1 = function (key) {
6389
+ if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
6390
+ var bankTransactionsForMonth = this_1.bankTransactions.filter(function (bankTransaction) {
6391
+ return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
6392
+ });
6393
+ var cashInForMonth = bankTransactionsForMonth
6394
+ .filter(function (bankTransaction) { return bankTransaction.isCredit(); })
6395
+ .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
6396
+ var cashOutForMonth = bankTransactionsForMonth
6397
+ .filter(function (bankTransaction) { return bankTransaction.isDebit(); })
6398
+ .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
6399
+ chartData[0].data.push({
6400
+ label: exports.MonthNameShortEnum[key],
6401
+ value: cashInForMonth
6402
+ });
6403
+ chartData[1].data.push({
6404
+ label: exports.MonthNameShortEnum[key],
6405
+ value: cashOutForMonth
6406
+ });
6407
+ }
6408
+ };
6409
+ var this_1 = this;
6410
+ for (var key in exports.MonthNameShortEnum) {
6411
+ _loop_1(key);
6412
+ }
6413
+ return chartData;
6084
6414
  };
6085
6415
  /**
6086
- * Get Collection of bank accounts with work tank type
6416
+ * set line chart data
6087
6417
  */
6088
- BankAccountCollection.prototype.getWorkBankAccounts = function () {
6089
- return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.isWorkTank(); }));
6418
+ BankTransactionChartData.prototype.calculateBalanceLineChartData = function () {
6419
+ var chartData = [{
6420
+ name: 'Balance',
6421
+ data: []
6422
+ }];
6423
+ var _loop_2 = function (key) {
6424
+ if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
6425
+ var bankTransactionsForMonth = this_2.bankTransactions.filter(function (bankTransaction) {
6426
+ return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
6427
+ });
6428
+ var balanceForMonth = bankTransactionsForMonth.reduce(function (sum, bankTransaction) {
6429
+ if (bankTransaction.isCredit()) {
6430
+ return sum += bankTransaction.allocatedAmount;
6431
+ }
6432
+ else {
6433
+ return sum -= bankTransaction.allocatedAmount;
6434
+ }
6435
+ }, 0);
6436
+ chartData[0].data.push({
6437
+ label: exports.MonthNameShortEnum[key],
6438
+ value: balanceForMonth
6439
+ });
6440
+ }
6441
+ };
6442
+ var this_2 = this;
6443
+ for (var key in exports.MonthNameShortEnum) {
6444
+ _loop_2(key);
6445
+ }
6446
+ return chartData;
6090
6447
  };
6091
6448
  /**
6092
- * Get Collection of bank accounts by tank type
6093
- */
6094
- BankAccountCollection.prototype.getByTankType = function (tankType) {
6095
- return new BankAccountCollection(this.items.filter(function (bankAccount) { return bankAccount.tankType === tankType; }));
6449
+ * filter chart data for passed months
6450
+ */
6451
+ BankTransactionChartData.prototype.filterChartDataByMonths = function (months, chartData) {
6452
+ var monthsNames = months.map(function (month) { return exports.MonthNumberEnum[month]; }).map(function (key) { return exports.MonthNameShortEnum[key]; });
6453
+ var filteredChartData = cloneDeep__default["default"](chartData);
6454
+ filteredChartData.forEach(function (chartDataItem) {
6455
+ chartDataItem.data = chartDataItem.data.filter(function (serie) { return monthsNames.includes(serie.label); });
6456
+ });
6457
+ return filteredChartData;
6096
6458
  };
6459
+ return BankTransactionChartData;
6460
+ }());
6461
+
6462
+ exports.BankTransactionSummaryFieldsEnum = void 0;
6463
+ (function (BankTransactionSummaryFieldsEnum) {
6464
+ BankTransactionSummaryFieldsEnum["AMOUNT"] = "amount";
6465
+ BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
6466
+ })(exports.BankTransactionSummaryFieldsEnum || (exports.BankTransactionSummaryFieldsEnum = {}));
6467
+
6468
+ var Document$1 = /** @class */ (function (_super) {
6469
+ __extends(Document, _super);
6470
+ function Document() {
6471
+ return _super !== null && _super.apply(this, arguments) || this;
6472
+ }
6473
+ return Document;
6474
+ }(AbstractModel));
6475
+
6476
+ /**
6477
+ * Enum with document types which used to API url prefix
6478
+ */
6479
+ exports.DocumentApiUrlPrefixEnum = void 0;
6480
+ (function (DocumentApiUrlPrefixEnum) {
6481
+ DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
6482
+ DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
6483
+ })(exports.DocumentApiUrlPrefixEnum || (exports.DocumentApiUrlPrefixEnum = {}));
6484
+
6485
+ var Document = /** @class */ (function (_super) {
6486
+ __extends(Document, _super);
6487
+ function Document() {
6488
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
6489
+ _this.type = exports.AssetTypeEnum.DOCUMENTS;
6490
+ _this.entityType = exports.AssetEntityTypeEnum.FOLDERS;
6491
+ return _this;
6492
+ }
6097
6493
  /**
6098
- * Get list of all bank account properties
6494
+ * Get folder as document parent entity
6099
6495
  */
6100
- BankAccountCollection.prototype.getBankAccountPropertiesList = function () {
6101
- return flatten__default["default"](this.items.map(function (bankAccount) {
6102
- return bankAccount.bankAccountProperties;
6103
- }));
6496
+ Document.prototype.getEntity = function () {
6497
+ return this.folder;
6104
6498
  };
6105
6499
  /**
6106
- * Get lis of unique properties from all bank accounts properties
6500
+ * Get API url prefix
6107
6501
  */
6108
- BankAccountCollection.prototype.getProperties = function () {
6109
- return uniqBy__default["default"](this.getBankAccountPropertiesList().map(function (bankAccountProperty) {
6110
- return bankAccountProperty.property;
6111
- }), 'id');
6112
- };
6113
- BankAccountCollection.prototype.getPropertyBalanceAmount = function (propertyId) {
6114
- return this.items.reduce(function (sum, bankAccount) {
6115
- return sum + bankAccount.getPropertyBalanceAmount(propertyId);
6116
- }, 0);
6502
+ Document.prototype.getApiUrlPrefix = function () {
6503
+ return exports.DocumentApiUrlPrefixEnum.FOLDERS;
6117
6504
  };
6118
- return BankAccountCollection;
6119
- }(Collection));
6505
+ return Document;
6506
+ }(Document$1));
6120
6507
 
6121
- var UserEventTypeTypeEnum;
6122
- (function (UserEventTypeTypeEnum) {
6123
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
6124
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PASSWORD_RESET_REQUEST"] = 1001] = "PASSWORD_RESET_REQUEST";
6125
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
6126
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
6127
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
6128
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
6129
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
6130
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_PAYMENT_FAILED"] = 2006] = "SUBSCRIPTION_PAYMENT_FAILED";
6131
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
6132
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
6133
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
6134
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
6135
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
6136
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
6137
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
6138
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
6139
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
6140
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
6141
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
6142
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
6143
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
6144
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_SUBSCRIBED"] = 2028] = "OWNER_SUBSCRIBED";
6145
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_UNSUBSCRIBED"] = 2029] = "OWNER_UNSUBSCRIBED";
6146
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
6147
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
6148
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
6149
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
6150
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
6151
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
6152
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_EMAIL_CONFIRMED"] = 2050] = "CLIENT_EMAIL_CONFIRMED";
6153
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
6154
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
6155
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
6156
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
6157
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
6158
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
6159
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
6160
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
6161
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
6162
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
6163
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
6164
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
6165
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_EMAIL_CONFIRMED"] = 3020] = "EMPLOYEE_EMAIL_CONFIRMED";
6166
- UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_RECEIVED"] = 3030] = "TAX_REVIEW_RECEIVED";
6167
- })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
6508
+ var DocumentFolder$1 = /** @class */ (function (_super) {
6509
+ __extends(DocumentFolder, _super);
6510
+ function DocumentFolder() {
6511
+ return _super !== null && _super.apply(this, arguments) || this;
6512
+ }
6513
+ return DocumentFolder;
6514
+ }(AbstractModel));
6168
6515
 
6169
- /**
6170
- * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
6171
- */
6172
- var AppEvent = /** @class */ (function () {
6173
- function AppEvent(type, payload) {
6174
- this.type = type;
6175
- this.payload = payload;
6516
+ var DocumentFolder = /** @class */ (function (_super) {
6517
+ __extends(DocumentFolder, _super);
6518
+ function DocumentFolder() {
6519
+ return _super !== null && _super.apply(this, arguments) || this;
6176
6520
  }
6177
- return AppEvent;
6178
- }());
6521
+ return DocumentFolder;
6522
+ }(DocumentFolder$1));
6523
+ __decorate([
6524
+ classTransformer.Type(function () { return Document; })
6525
+ ], DocumentFolder.prototype, "documents", void 0);
6179
6526
 
6180
6527
  /**
6181
6528
  * BankConnection means user account at specific bank (usually each user has only one at the same bank)
@@ -6275,6 +6622,7 @@
6275
6622
  */
6276
6623
  BasiqService.prototype.listenEvents = function () {
6277
6624
  this.listenNotifications();
6625
+ this.listenJobs();
6278
6626
  };
6279
6627
  /**
6280
6628
  * Create a new Bank connection based on Basiq job.
@@ -6287,6 +6635,7 @@
6287
6635
  // Send login data to basiq API to create a basiq job
6288
6636
  return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", loginData)
6289
6637
  .pipe(operators.mergeMap(function (response) {
6638
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
6290
6639
  // Create bank connection based on basiq job
6291
6640
  return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, { basiqJob: { externalId: response.id } }));
6292
6641
  }), operators.catchError(function (error) {
@@ -6308,8 +6657,12 @@
6308
6657
  // Send login data and connection id to basiq API to create a basiq job
6309
6658
  return this.http.post(BasiqService.basiqApiUrl + "/users/" + userId + "/connections", Object.assign(data, { id: connection.externalId }))
6310
6659
  .pipe(operators.mergeMap(function (response) {
6660
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_JOB_CREATED, response.id));
6311
6661
  // Create bank connection based on basiq job
6312
- return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, { id: connection.id, basiqJob: { externalId: response.id } }));
6662
+ return _this.bankConnectionService.add(classTransformer.plainToClass(BankConnection, {
6663
+ id: connection.id,
6664
+ basiqJob: { externalId: response.id }
6665
+ }));
6313
6666
  }), operators.catchError(function (error) {
6314
6667
  // Show error when user provided wrong login data
6315
6668
  if (error.status === 401) {
@@ -6332,6 +6685,35 @@
6332
6685
  return bankAccounts.removeBy('accountId', savedAccounts.mapBy('accountId'));
6333
6686
  }));
6334
6687
  };
6688
+ /**
6689
+ * Get status of credentials verifying. Expected statuses: 'in-progress', 'failed' or 'success'
6690
+ * We send this request by interval until basiq return success or failed
6691
+ * @TODO Alex (TT-2431): check logic and try to remove subscribe, use pipes instead
6692
+ * @TODO Alex (TT-2431): implement some limit and handle (message or something) if basiq stuck
6693
+ * @TODO Alex (TT-2431): check logic and handle case when user cancelled loading
6694
+ */
6695
+ BasiqService.prototype.checkBankCredentials = function (jobId) {
6696
+ var _this = this;
6697
+ this.http.get(BasiqService.basiqApiUrl + "/jobs/" + jobId)
6698
+ .pipe(
6699
+ // 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)
6700
+ operators.take(1),
6701
+ // get verify-credentials step from basiq job
6702
+ operators.map(function (response) { return classTransformer.plainToClass(BasiqJobResponse, response).getVerifyCredentialsStep(); }),
6703
+ // check credentials status again if not finished
6704
+ operators.filter(function (step) {
6705
+ if (!step.isInProgress()) {
6706
+ return true;
6707
+ }
6708
+ setTimeout(function () {
6709
+ _this.checkBankCredentials(jobId);
6710
+ }, BasiqService.bankCredintialsCheckInterval);
6711
+ return false;
6712
+ }))
6713
+ .subscribe(function (step) {
6714
+ _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_LOGIN_FINISHED, step.isSuccess()));
6715
+ });
6716
+ };
6335
6717
  /**
6336
6718
  * listen to notifications to update basiq accounts list
6337
6719
  */
@@ -6343,9 +6725,22 @@
6343
6725
  }
6344
6726
  });
6345
6727
  };
6728
+ /**
6729
+ * Listen Basiq job created to check its verify credentials status
6730
+ */
6731
+ BasiqService.prototype.listenJobs = function () {
6732
+ var _this = this;
6733
+ this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_JOB_CREATED).subscribe(function (jobId) {
6734
+ _this.checkBankCredentials(jobId);
6735
+ });
6736
+ };
6346
6737
  return BasiqService;
6347
6738
  }(RestService));
6348
6739
  BasiqService.basiqApiUrl = 'https://au-api.basiq.io';
6740
+ /**
6741
+ * Basiq does not provide a hook, so we have to check job status manually every x seconds
6742
+ */
6743
+ BasiqService.bankCredintialsCheckInterval = 3000;
6349
6744
  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 });
6350
6745
  BasiqService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, providedIn: 'root' });
6351
6746
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, decorators: [{
@@ -6360,20 +6755,6 @@
6360
6755
  }] }, { type: ToastService }, { type: BankConnectionService }];
6361
6756
  } });
6362
6757
 
6363
- /**
6364
- * access token, needed to access basiq connect ui (https://github.com/basiqio/basiq-connect-ui)
6365
- */
6366
- var BasiqToken = /** @class */ (function () {
6367
- function BasiqToken(value, expiresAt) {
6368
- this.value = value;
6369
- this.expiresAt = expiresAt;
6370
- }
6371
- BasiqToken.prototype.isExpired = function () {
6372
- return this.expiresAt < new Date();
6373
- };
6374
- return BasiqToken;
6375
- }());
6376
-
6377
6758
  var BasiqTokenService = /** @class */ (function () {
6378
6759
  function BasiqTokenService(http, environment) {
6379
6760
  this.http = http;
@@ -6631,6 +7012,12 @@
6631
7012
  */
6632
7013
  UserService.prototype.createBasiq = function () {
6633
7014
  var _this = this;
7015
+ var _a;
7016
+ // no need to create basiqId if already exist
7017
+ // @TODO Alex (TT-2431): move this check to component or separated method
7018
+ if ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.basiqId) {
7019
+ return rxjs.of(this.cache.basiqId);
7020
+ }
6634
7021
  return this.http.post(this.environment.apiV2 + "/basiq/user", {})
6635
7022
  .pipe(operators.map(function (basiqId) {
6636
7023
  _this.cache = classTransformer.plainToClass(User, Object.assign(_this.cache, { basiqId: basiqId }));
@@ -6786,91 +7173,32 @@
6786
7173
  return {
6787
7174
  ngModule: TtCoreModule,
6788
7175
  providers: [
6789
- {
6790
- provide: 'environment',
6791
- useValue: environment
6792
- }
6793
- ]
6794
- };
6795
- };
6796
- return TtCoreModule;
6797
- }());
6798
- TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
6799
- TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i1$1.CommonModule,
6800
- InterceptorsModule] });
6801
- TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
6802
- i1$1.CommonModule,
6803
- InterceptorsModule
6804
- ]] });
6805
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
6806
- type: i0.NgModule,
6807
- args: [{
6808
- declarations: [],
6809
- imports: [
6810
- i1$1.CommonModule,
6811
- InterceptorsModule
6812
- ]
6813
- }]
6814
- }] });
6815
-
6816
- var Document$1 = /** @class */ (function (_super) {
6817
- __extends(Document, _super);
6818
- function Document() {
6819
- return _super !== null && _super.apply(this, arguments) || this;
6820
- }
6821
- return Document;
6822
- }(AbstractModel));
6823
-
6824
- /**
6825
- * Enum with document types which used to API url prefix
6826
- */
6827
- exports.DocumentApiUrlPrefixEnum = void 0;
6828
- (function (DocumentApiUrlPrefixEnum) {
6829
- DocumentApiUrlPrefixEnum["FOLDERS"] = "folders";
6830
- DocumentApiUrlPrefixEnum["PROPERTIES"] = "properties";
6831
- })(exports.DocumentApiUrlPrefixEnum || (exports.DocumentApiUrlPrefixEnum = {}));
6832
-
6833
- var Document = /** @class */ (function (_super) {
6834
- __extends(Document, _super);
6835
- function Document() {
6836
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
6837
- _this.type = exports.AssetTypeEnum.DOCUMENTS;
6838
- _this.entityType = exports.AssetEntityTypeEnum.FOLDERS;
6839
- return _this;
6840
- }
6841
- /**
6842
- * Get folder as document parent entity
6843
- */
6844
- Document.prototype.getEntity = function () {
6845
- return this.folder;
6846
- };
6847
- /**
6848
- * Get API url prefix
6849
- */
6850
- Document.prototype.getApiUrlPrefix = function () {
6851
- return exports.DocumentApiUrlPrefixEnum.FOLDERS;
6852
- };
6853
- return Document;
6854
- }(Document$1));
6855
-
6856
- var DocumentFolder$1 = /** @class */ (function (_super) {
6857
- __extends(DocumentFolder, _super);
6858
- function DocumentFolder() {
6859
- return _super !== null && _super.apply(this, arguments) || this;
6860
- }
6861
- return DocumentFolder;
6862
- }(AbstractModel));
6863
-
6864
- var DocumentFolder = /** @class */ (function (_super) {
6865
- __extends(DocumentFolder, _super);
6866
- function DocumentFolder() {
6867
- return _super !== null && _super.apply(this, arguments) || this;
6868
- }
6869
- return DocumentFolder;
6870
- }(DocumentFolder$1));
6871
- __decorate([
6872
- classTransformer.Type(function () { return Document; })
6873
- ], DocumentFolder.prototype, "documents", void 0);
7176
+ {
7177
+ provide: 'environment',
7178
+ useValue: environment
7179
+ }
7180
+ ]
7181
+ };
7182
+ };
7183
+ return TtCoreModule;
7184
+ }());
7185
+ TtCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
7186
+ TtCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [i1$1.CommonModule,
7187
+ InterceptorsModule] });
7188
+ TtCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, imports: [[
7189
+ i1$1.CommonModule,
7190
+ InterceptorsModule
7191
+ ]] });
7192
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TtCoreModule, decorators: [{
7193
+ type: i0.NgModule,
7194
+ args: [{
7195
+ declarations: [],
7196
+ imports: [
7197
+ i1$1.CommonModule,
7198
+ InterceptorsModule
7199
+ ]
7200
+ }]
7201
+ }] });
6874
7202
 
6875
7203
  var VehicleClaimCollection = /** @class */ (function (_super) {
6876
7204
  __extends(VehicleClaimCollection, _super);
@@ -9409,236 +9737,6 @@
9409
9737
  return Badge;
9410
9738
  }(AbstractModel));
9411
9739
 
9412
- /**
9413
- * bank account collection UI class with frontend specific data
9414
- */
9415
- var BankAccountChartData = /** @class */ (function () {
9416
- function BankAccountChartData(bankAccounts) {
9417
- this.bankAccounts = bankAccounts;
9418
- }
9419
- /**
9420
- * set value of pie chart data
9421
- */
9422
- BankAccountChartData.prototype.getBalancePieChartData = function () {
9423
- return this.bankAccounts.map(function (bankAccount) {
9424
- return {
9425
- name: bankAccount.accountName,
9426
- data: Math.abs(bankAccount.currentBalance)
9427
- };
9428
- });
9429
- };
9430
- /**
9431
- * set value of bar chart data
9432
- */
9433
- BankAccountChartData.prototype.getBalanceBarChartData = function () {
9434
- return [{
9435
- name: 'Balance',
9436
- data: this.bankAccounts.map(function (bankAccount) {
9437
- return {
9438
- label: bankAccount.accountName,
9439
- value: bankAccount.currentBalance
9440
- };
9441
- })
9442
- }];
9443
- };
9444
- return BankAccountChartData;
9445
- }());
9446
-
9447
- /**
9448
- * Const which contains array of bank account types
9449
- */
9450
- var BANK_ACCOUNT_TYPES = [
9451
- { key: exports.BankAccountTypeEnum.CREDIT_CARD, value: 'Credit Card Accounts' },
9452
- { key: exports.BankAccountTypeEnum.TERM_DEPOSIT, value: 'Deposit Accounts' },
9453
- { key: exports.BankAccountTypeEnum.INVESTMENT, value: 'Investment Accounts' },
9454
- { key: exports.BankAccountTypeEnum.LOAN, value: 'Loan Accounts' },
9455
- { key: exports.BankAccountTypeEnum.OFFSET, value: 'Offset' },
9456
- { key: exports.BankAccountTypeEnum.SAVINGS, value: 'Savings Accounts' },
9457
- { key: exports.BankAccountTypeEnum.TRANSACTION, value: 'Transaction Accounts' },
9458
- ];
9459
-
9460
- /**
9461
- * Login data object for basiq banks
9462
- */
9463
- var BankLoginData = /** @class */ (function () {
9464
- function BankLoginData() {
9465
- }
9466
- return BankLoginData;
9467
- }());
9468
-
9469
- /**
9470
- * enum with months indexes.
9471
- * item value match with js Date month index from 0 to 11
9472
- * Order of items match with financial year months order
9473
- */
9474
- exports.MonthNumberEnum = void 0;
9475
- (function (MonthNumberEnum) {
9476
- MonthNumberEnum[MonthNumberEnum["JULY"] = 6] = "JULY";
9477
- MonthNumberEnum[MonthNumberEnum["AUGUST"] = 7] = "AUGUST";
9478
- MonthNumberEnum[MonthNumberEnum["SEPTEMBER"] = 8] = "SEPTEMBER";
9479
- MonthNumberEnum[MonthNumberEnum["OCTOBER"] = 9] = "OCTOBER";
9480
- MonthNumberEnum[MonthNumberEnum["NOVEMBER"] = 10] = "NOVEMBER";
9481
- MonthNumberEnum[MonthNumberEnum["DECEMBER"] = 11] = "DECEMBER";
9482
- MonthNumberEnum[MonthNumberEnum["JANUARY"] = 0] = "JANUARY";
9483
- MonthNumberEnum[MonthNumberEnum["FEBRUARY"] = 1] = "FEBRUARY";
9484
- MonthNumberEnum[MonthNumberEnum["MARCH"] = 2] = "MARCH";
9485
- MonthNumberEnum[MonthNumberEnum["APRIL"] = 3] = "APRIL";
9486
- MonthNumberEnum[MonthNumberEnum["MAY"] = 4] = "MAY";
9487
- MonthNumberEnum[MonthNumberEnum["JUNE"] = 5] = "JUNE";
9488
- })(exports.MonthNumberEnum || (exports.MonthNumberEnum = {}));
9489
-
9490
- /**
9491
- * @TODO move to pipe/translation
9492
- * enum with months short names.
9493
- * Order of items match with financial year months order
9494
- */
9495
- exports.MonthNameShortEnum = void 0;
9496
- (function (MonthNameShortEnum) {
9497
- MonthNameShortEnum["JULY"] = "Jul";
9498
- MonthNameShortEnum["AUGUST"] = "Aug";
9499
- MonthNameShortEnum["SEPTEMBER"] = "Sep";
9500
- MonthNameShortEnum["OCTOBER"] = "Oct";
9501
- MonthNameShortEnum["NOVEMBER"] = "Nov";
9502
- MonthNameShortEnum["DECEMBER"] = "Dec";
9503
- MonthNameShortEnum["JANUARY"] = "Jan";
9504
- MonthNameShortEnum["FEBRUARY"] = "Feb";
9505
- MonthNameShortEnum["MARCH"] = "Mar";
9506
- MonthNameShortEnum["APRIL"] = "Apr";
9507
- MonthNameShortEnum["MAY"] = "May";
9508
- MonthNameShortEnum["JUNE"] = "Jun";
9509
- })(exports.MonthNameShortEnum || (exports.MonthNameShortEnum = {}));
9510
-
9511
- /**
9512
- * bank transactions collection UI class with frontend specific data
9513
- */
9514
- var BankTransactionChartData = /** @class */ (function () {
9515
- function BankTransactionChartData(bankTransactions) {
9516
- this.bankTransactions = bankTransactions;
9517
- }
9518
- /**
9519
- * get value of bar chart data
9520
- */
9521
- BankTransactionChartData.prototype.getCashInOutBarChartData = function (months) {
9522
- var chartData = this.calculateCashInOutBarChartData();
9523
- if (!months) {
9524
- return chartData;
9525
- }
9526
- return this.filterChartDataByMonths(months, chartData);
9527
- };
9528
- /**
9529
- * get value of line chart data
9530
- */
9531
- BankTransactionChartData.prototype.getBalanceLineChartData = function (months) {
9532
- var chartData = this.calculateBalanceLineChartData();
9533
- if (!months) {
9534
- return chartData;
9535
- }
9536
- return this.filterChartDataByMonths(months, chartData);
9537
- };
9538
- /**
9539
- * set bar chart data
9540
- */
9541
- BankTransactionChartData.prototype.calculateCashInOutBarChartData = function () {
9542
- var chartData = [{
9543
- name: 'Cash In',
9544
- data: []
9545
- }, {
9546
- name: 'Cash Out',
9547
- data: []
9548
- }];
9549
- var _loop_1 = function (key) {
9550
- if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
9551
- var bankTransactionsForMonth = this_1.bankTransactions.filter(function (bankTransaction) {
9552
- return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
9553
- });
9554
- var cashInForMonth = bankTransactionsForMonth
9555
- .filter(function (bankTransaction) { return bankTransaction.isCredit(); })
9556
- .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
9557
- var cashOutForMonth = bankTransactionsForMonth
9558
- .filter(function (bankTransaction) { return bankTransaction.isDebit(); })
9559
- .reduce(function (sum, bankTransaction) { return sum += bankTransaction.allocatedAmount; }, 0);
9560
- chartData[0].data.push({
9561
- label: exports.MonthNameShortEnum[key],
9562
- value: cashInForMonth
9563
- });
9564
- chartData[1].data.push({
9565
- label: exports.MonthNameShortEnum[key],
9566
- value: cashOutForMonth
9567
- });
9568
- }
9569
- };
9570
- var this_1 = this;
9571
- for (var key in exports.MonthNameShortEnum) {
9572
- _loop_1(key);
9573
- }
9574
- return chartData;
9575
- };
9576
- /**
9577
- * set line chart data
9578
- */
9579
- BankTransactionChartData.prototype.calculateBalanceLineChartData = function () {
9580
- var chartData = [{
9581
- name: 'Balance',
9582
- data: []
9583
- }];
9584
- var _loop_2 = function (key) {
9585
- if (exports.MonthNameShortEnum.hasOwnProperty(key)) {
9586
- var bankTransactionsForMonth = this_2.bankTransactions.filter(function (bankTransaction) {
9587
- return +bankTransaction.date.getMonth() === +exports.MonthNumberEnum[key];
9588
- });
9589
- var balanceForMonth = bankTransactionsForMonth.reduce(function (sum, bankTransaction) {
9590
- if (bankTransaction.isCredit()) {
9591
- return sum += bankTransaction.allocatedAmount;
9592
- }
9593
- else {
9594
- return sum -= bankTransaction.allocatedAmount;
9595
- }
9596
- }, 0);
9597
- chartData[0].data.push({
9598
- label: exports.MonthNameShortEnum[key],
9599
- value: balanceForMonth
9600
- });
9601
- }
9602
- };
9603
- var this_2 = this;
9604
- for (var key in exports.MonthNameShortEnum) {
9605
- _loop_2(key);
9606
- }
9607
- return chartData;
9608
- };
9609
- /**
9610
- * filter chart data for passed months
9611
- */
9612
- BankTransactionChartData.prototype.filterChartDataByMonths = function (months, chartData) {
9613
- var monthsNames = months.map(function (month) { return exports.MonthNumberEnum[month]; }).map(function (key) { return exports.MonthNameShortEnum[key]; });
9614
- var filteredChartData = cloneDeep__default["default"](chartData);
9615
- filteredChartData.forEach(function (chartDataItem) {
9616
- chartDataItem.data = chartDataItem.data.filter(function (serie) { return monthsNames.includes(serie.label); });
9617
- });
9618
- return filteredChartData;
9619
- };
9620
- return BankTransactionChartData;
9621
- }());
9622
-
9623
- exports.BankTransactionSummaryFieldsEnum = void 0;
9624
- (function (BankTransactionSummaryFieldsEnum) {
9625
- BankTransactionSummaryFieldsEnum["AMOUNT"] = "amount";
9626
- BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
9627
- })(exports.BankTransactionSummaryFieldsEnum || (exports.BankTransactionSummaryFieldsEnum = {}));
9628
-
9629
- /**
9630
- * Class describe configuration options for basiq connect control
9631
- * https://www.npmjs.com/package/@basiq/basiq-connect-control
9632
- */
9633
- var BasiqConfig = /** @class */ (function () {
9634
- function BasiqConfig(options) {
9635
- // ID of the DOM element to which Basiq Connect Control will be rendered;
9636
- this.containerId = 'basiq-control';
9637
- Object.assign(this, options);
9638
- }
9639
- return BasiqConfig;
9640
- }());
9641
-
9642
9740
  var BorrowingExpense$1 = /** @class */ (function (_super) {
9643
9741
  __extends(BorrowingExpense, _super);
9644
9742
  function BorrowingExpense() {
@@ -19195,6 +19293,7 @@
19195
19293
  exports.BankAccountsImportForm = BankAccountsImportForm;
19196
19294
  exports.BankConnection = BankConnection;
19197
19295
  exports.BankConnectionService = BankConnectionService;
19296
+ exports.BankExternalStats = BankExternalStats;
19198
19297
  exports.BankLoginData = BankLoginData;
19199
19298
  exports.BankLoginForm = BankLoginForm;
19200
19299
  exports.BankService = BankService;
@@ -19205,8 +19304,11 @@
19205
19304
  exports.BankTransactionService = BankTransactionService;
19206
19305
  exports.BasiqConfig = BasiqConfig;
19207
19306
  exports.BasiqJob = BasiqJob;
19307
+ exports.BasiqJobResponse = BasiqJobResponse;
19308
+ exports.BasiqJobStep = BasiqJobStep;
19208
19309
  exports.BasiqService = BasiqService;
19209
19310
  exports.BasiqToken = BasiqToken;
19311
+ exports.BasiqTokenService = BasiqTokenService;
19210
19312
  exports.BorrowingExpense = BorrowingExpense;
19211
19313
  exports.BorrowingExpenseLoan = BorrowingExpenseLoan;
19212
19314
  exports.BorrowingExpenseService = BorrowingExpenseService;