taxtank-core 0.28.6 → 0.28.9

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 (28) hide show
  1. package/bundles/taxtank-core.umd.js +109 -42
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/bank-transaction.collection.js +2 -2
  4. package/esm2015/lib/db/Enums/user-event-type-type.enum.js +48 -0
  5. package/esm2015/lib/forms/bank/bank-account/bank-account-import.form.js +3 -3
  6. package/esm2015/lib/forms/loan/loan.form.js +5 -1
  7. package/esm2015/lib/models/loan/loan-max-number-of-payments.enum.js +3 -2
  8. package/esm2015/lib/models/notification/notification.js +1 -1
  9. package/esm2015/lib/services/bank/bank-account-calculation.service.js +9 -3
  10. package/esm2015/lib/services/bank/bank-transaction-calculation.service.js +2 -2
  11. package/esm2015/lib/services/http/bank/bank-connection/bank-connection.service.js +13 -4
  12. package/esm2015/lib/services/http/bank/bank-transaction/bank-transaction.service.js +3 -3
  13. package/esm2015/lib/services/http/bank/basiq/basiq.service.js +3 -3
  14. package/esm2015/lib/services/http/firm/client-invite/client-invite.service.js +3 -3
  15. package/esm2015/lib/services/http/firm/client-movement/client-movement.service.js +3 -3
  16. package/esm2015/lib/services/http/service-notification/service-notification.service.js +2 -1
  17. package/esm2015/lib/services/http/tax-review/tax-review.service.js +3 -3
  18. package/fesm2015/taxtank-core.js +109 -42
  19. package/fesm2015/taxtank-core.js.map +1 -1
  20. package/lib/collections/bank-transaction.collection.d.ts +1 -1
  21. package/lib/db/Enums/user-event-type-type.enum.d.ts +46 -0
  22. package/lib/forms/loan/loan.form.d.ts +1 -0
  23. package/lib/models/loan/loan-max-number-of-payments.enum.d.ts +2 -1
  24. package/lib/models/notification/notification.d.ts +2 -4
  25. package/lib/services/bank/bank-account-calculation.service.d.ts +2 -1
  26. package/lib/services/bank/bank-transaction-calculation.service.d.ts +1 -1
  27. package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +3 -1
  28. package/package.json +1 -1
@@ -1177,35 +1177,6 @@
1177
1177
  type: i0.Injectable
1178
1178
  }], ctorParameters: function () { return [{ type: PreloaderService }]; } });
1179
1179
 
1180
- exports.UserEventTypeClientTypeEnum = void 0;
1181
- (function (UserEventTypeClientTypeEnum) {
1182
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
1183
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
1184
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
1185
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
1186
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
1187
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
1188
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
1189
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
1190
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
1191
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
1192
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
1193
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
1194
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
1195
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
1196
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
1197
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
1198
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
1199
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
1200
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
1201
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
1202
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
1203
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
1204
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
1205
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["EMAIL_CONFIRMED"] = 2050] = "EMAIL_CONFIRMED";
1206
- UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
1207
- })(exports.UserEventTypeClientTypeEnum || (exports.UserEventTypeClientTypeEnum = {}));
1208
-
1209
1180
  // replace array element with the new one (only arrays of objects)
1210
1181
  function replace(array, item, matchField) {
1211
1182
  if (matchField === void 0) { matchField = 'id'; }
@@ -5888,6 +5859,54 @@
5888
5859
  return BankAccountCollection;
5889
5860
  }(Collection));
5890
5861
 
5862
+ var UserEventTypeTypeEnum;
5863
+ (function (UserEventTypeTypeEnum) {
5864
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTERED"] = 1000] = "REGISTERED";
5865
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PASSWORD_RESET_REQUEST"] = 1001] = "PASSWORD_RESET_REQUEST";
5866
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["APP_FEATURES"] = 1010] = "APP_FEATURES";
5867
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
5868
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
5869
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
5870
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
5871
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["SUBSCRIPTION_PAYMENT_FAILED"] = 2006] = "SUBSCRIPTION_PAYMENT_FAILED";
5872
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
5873
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
5874
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
5875
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
5876
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
5877
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
5878
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
5879
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
5880
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
5881
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
5882
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
5883
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
5884
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
5885
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_SUBSCRIBED"] = 2028] = "OWNER_SUBSCRIBED";
5886
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["OWNER_UNSUBSCRIBED"] = 2029] = "OWNER_UNSUBSCRIBED";
5887
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
5888
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
5889
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
5890
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
5891
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
5892
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
5893
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_EMAIL_CONFIRMED"] = 2050] = "CLIENT_EMAIL_CONFIRMED";
5894
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
5895
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE_TO_REGISTER"] = 3000] = "FIRM_INVITE_TO_REGISTER";
5896
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_INVITE"] = 3001] = "FIRM_INVITE";
5897
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_ACCEPTED"] = 3002] = "CLIENT_INVITE_ACCEPTED";
5898
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REJECTED"] = 3003] = "CLIENT_INVITE_REJECTED";
5899
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["CLIENT_INVITE_REGISTERED"] = 3004] = "CLIENT_INVITE_REGISTERED";
5900
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_NEW_CLIENT"] = 3005] = "FIRM_NEW_CLIENT";
5901
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["FIRM_LOST_CLIENT"] = 3006] = "FIRM_LOST_CLIENT";
5902
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE"] = 3010] = "EMPLOYEE_INVITE";
5903
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_LOST_CLIENT"] = 3011] = "EMPLOYEE_LOST_CLIENT";
5904
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_NEW_CLIENT"] = 3012] = "EMPLOYEE_NEW_CLIENT";
5905
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_INVITE_ACCEPTED"] = 3013] = "EMPLOYEE_INVITE_ACCEPTED";
5906
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["EMPLOYEE_EMAIL_CONFIRMED"] = 3020] = "EMPLOYEE_EMAIL_CONFIRMED";
5907
+ UserEventTypeTypeEnum[UserEventTypeTypeEnum["TAX_REVIEW_RECEIVED"] = 3030] = "TAX_REVIEW_RECEIVED";
5908
+ })(UserEventTypeTypeEnum || (UserEventTypeTypeEnum = {}));
5909
+
5891
5910
  /**
5892
5911
  * any event happened in the app, which needs to be handled somehow (distributed to other part of the app)
5893
5912
  */
@@ -5945,18 +5964,27 @@
5945
5964
  });
5946
5965
  };
5947
5966
  /**
5948
- * Update cache when basiq login failed to get actual connections statuses
5967
+ * Update cache when basiq accounts were retrieved or login to basic was failed to get actual connections statuses
5949
5968
  */
5950
5969
  BankConnectionService.prototype.listenNotifications = function () {
5951
5970
  var _this = this;
5971
+ // @TODO vik listen sse when backend updated
5952
5972
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
5953
- if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_AUTHORIZATION_FAIL) {
5973
+ // @Todo TT-2280 Alex refactor ServiceNotification isRead logic. We don't need to know here whether notification was read or not
5974
+ if (!notification.isRead) {
5975
+ return;
5976
+ }
5977
+ if (BankConnectionService.userEventTypes.includes(notification.eventType)) {
5954
5978
  _this.resetCache();
5955
5979
  }
5956
5980
  });
5957
5981
  };
5958
5982
  return BankConnectionService;
5959
5983
  }(RestService));
5984
+ BankConnectionService.userEventTypes = [
5985
+ UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS,
5986
+ UserEventTypeTypeEnum.BASIQ_AUTHORIZATION_FAIL
5987
+ ];
5960
5988
  BankConnectionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
5961
5989
  BankConnectionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, providedIn: 'root' });
5962
5990
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BankConnectionService, decorators: [{
@@ -6051,7 +6079,7 @@
6051
6079
  BasiqService.prototype.listenNotifications = function () {
6052
6080
  var _this = this;
6053
6081
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
6054
- if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_NEW_ACCOUNTS) {
6082
+ if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.BASIQ_NEW_ACCOUNTS) {
6055
6083
  _this.resetCache();
6056
6084
  }
6057
6085
  });
@@ -6810,7 +6838,7 @@
6810
6838
  /**
6811
6839
  * Get collection of unallocated bankTransactions
6812
6840
  */
6813
- BankTransactionCollection.prototype.getUnallocatedBankTransactions = function (allocations) {
6841
+ BankTransactionCollection.prototype.getUnallocated = function (allocations) {
6814
6842
  return new BankTransactionCollection(this.items.filter(function (bankTransaction) { return !bankTransaction.isAllocated(allocations); }));
6815
6843
  };
6816
6844
  return BankTransactionCollection;
@@ -8759,6 +8787,35 @@
8759
8787
  UserEventTypeEmployeeTypeEnum[UserEventTypeEmployeeTypeEnum["TAX_REVIEW_REQUESTED"] = 3030] = "TAX_REVIEW_REQUESTED";
8760
8788
  })(exports.UserEventTypeEmployeeTypeEnum || (exports.UserEventTypeEmployeeTypeEnum = {}));
8761
8789
 
8790
+ exports.UserEventTypeClientTypeEnum = void 0;
8791
+ (function (UserEventTypeClientTypeEnum) {
8792
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIBED"] = 2000] = "SUBSCRIBED";
8793
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["UNSUBSCRIBED"] = 2001] = "UNSUBSCRIBED";
8794
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_UPDATE"] = 2004] = "SUBSCRIPTION_UPDATE";
8795
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["SUBSCRIPTION_TRIAL_UPDATE"] = 2005] = "SUBSCRIPTION_TRIAL_UPDATE";
8796
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE"] = 2010] = "CLIENT_INVITE";
8797
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["CLIENT_INVITE_TO_REGISTER"] = 2011] = "CLIENT_INVITE_TO_REGISTER";
8798
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
8799
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
8800
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
8801
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
8802
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
8803
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
8804
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
8805
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
8806
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
8807
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
8808
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
8809
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
8810
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
8811
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
8812
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TRANSACTION_ALLOCATE_REMINDER"] = 2033] = "TRANSACTION_ALLOCATE_REMINDER";
8813
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE"] = 2040] = "REGISTRATION_INVITE";
8814
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["REGISTRATION_INVITE_ACCEPTED"] = 2041] = "REGISTRATION_INVITE_ACCEPTED";
8815
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["EMAIL_CONFIRMED"] = 2050] = "EMAIL_CONFIRMED";
8816
+ UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["TAX_REVIEW_REQUESTED"] = 2060] = "TAX_REVIEW_REQUESTED";
8817
+ })(exports.UserEventTypeClientTypeEnum || (exports.UserEventTypeClientTypeEnum = {}));
8818
+
8762
8819
  exports.UserMedicareExemptionEnum = void 0;
8763
8820
  (function (UserMedicareExemptionEnum) {
8764
8821
  UserMedicareExemptionEnum[UserMedicareExemptionEnum["NO"] = 0] = "NO";
@@ -9840,7 +9897,8 @@
9840
9897
  }());
9841
9898
 
9842
9899
  /**
9843
- * Enum with maximum number of payments, depending on the frequency
9900
+ * Enum with maximum number of payments, depending on the frequency.
9901
+ * Used only for vehicle loans
9844
9902
  */
9845
9903
  exports.LoanMaxNumberOfPaymentsEnum = void 0;
9846
9904
  (function (LoanMaxNumberOfPaymentsEnum) {
@@ -13414,7 +13472,7 @@
13414
13472
  * Get collection of unallocated bank transactions
13415
13473
  * @TODO Alex: consider to move to collection
13416
13474
  */
13417
- BankTransactionCalculationService.prototype.getUnallocatedBankTransactions = function (bankTransactions, allocations) {
13475
+ BankTransactionCalculationService.prototype.getUnallocated = function (bankTransactions, allocations) {
13418
13476
  var _this = this;
13419
13477
  return new BankTransactionCollection(bankTransactions.items.filter(function (bankTransaction) {
13420
13478
  return !_this.isAllocated(bankTransaction, allocations);
@@ -13451,8 +13509,12 @@
13451
13509
  * Sum of bank accounts opening balances and their bank transactions allocated amounts
13452
13510
  */
13453
13511
  BankAccountCalculationService.prototype.getTaxTankBalance = function (bankAccounts, bankTransactions, allocations) {
13454
- return bankAccounts.getOpeningBalance() +
13455
- this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccounts.getIds()), allocations);
13512
+ // wrap in a collection if a single bank account was provided
13513
+ var bankAccountCollection = bankAccounts instanceof BankAccount ?
13514
+ new BankAccountCollection([bankAccounts]) :
13515
+ bankAccounts;
13516
+ return bankAccountCollection.getOpeningBalance() +
13517
+ this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccountCollection.getIds()), allocations);
13456
13518
  };
13457
13519
  /**
13458
13520
  * get difference between total loans amount and total cash amount
@@ -13532,7 +13594,7 @@
13532
13594
  BankTransactionService.prototype.listenBankTransactionsImport = function () {
13533
13595
  var _this = this;
13534
13596
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
13535
- if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
13597
+ if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.BASIQ_FIRST_IMPORT_COMPLETE) {
13536
13598
  _this.resetCache();
13537
13599
  }
13538
13600
  });
@@ -14094,7 +14156,7 @@
14094
14156
  ClientInviteService.prototype.listenNotifications = function () {
14095
14157
  var _this = this;
14096
14158
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
14097
- if (!notification.isRead && (notification.eventType === exports.UserEventTypeClientTypeEnum.FIRM_INVITE_ACCEPTED || notification.eventType === exports.UserEventTypeClientTypeEnum.CLIENT_INVITE)) {
14159
+ if (!notification.isRead && (notification.eventType === UserEventTypeTypeEnum.FIRM_INVITE_ACCEPTED || notification.eventType === UserEventTypeTypeEnum.CLIENT_INVITE)) {
14098
14160
  _this.resetCache();
14099
14161
  }
14100
14162
  });
@@ -14173,7 +14235,7 @@
14173
14235
  ClientMovementService.prototype.listenNotifications = function () {
14174
14236
  var _this = this;
14175
14237
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
14176
- if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.FIRM_INVITE_ACCEPTED) {
14238
+ if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.FIRM_INVITE_ACCEPTED) {
14177
14239
  _this.resetCache();
14178
14240
  }
14179
14241
  });
@@ -15255,6 +15317,7 @@
15255
15317
  }
15256
15318
  _this.cache = cache;
15257
15319
  _this.cacheSubject.next(_this.cache);
15320
+ // @TODO TT-2280 Alex wrong event, it's updated, added or deleted. Not just added
15258
15321
  _this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.NOTIFICATION_ADDED, notification));
15259
15322
  });
15260
15323
  };
@@ -16284,7 +16347,7 @@
16284
16347
  TaxReviewService.prototype.listenNotifications = function () {
16285
16348
  var _this = this;
16286
16349
  this.eventDispatcherService.on(exports.AppEventTypeEnum.NOTIFICATION_ADDED).subscribe(function (notification) {
16287
- if (!notification.isRead && notification.eventType === exports.UserEventTypeClientTypeEnum.FIRM_INVITE_ACCEPTED) {
16350
+ if (!notification.isRead && notification.eventType === UserEventTypeTypeEnum.FIRM_INVITE_ACCEPTED) {
16288
16351
  _this.resetCache();
16289
16352
  }
16290
16353
  });
@@ -16869,6 +16932,10 @@
16869
16932
  * For vehicle loans term has a maximum value depended of repayment frequency
16870
16933
  */
16871
16934
  LoanForm.prototype.updateTermValidation = function () {
16935
+ // no need terms for bank loans
16936
+ if (!!this.loan.bankAccount) {
16937
+ return;
16938
+ }
16872
16939
  var currentRepaymentFrequency = this.get('repaymentFrequency').value;
16873
16940
  // term validation depends on selected repayment frequency, so can not validate when frequency is empty
16874
16941
  // repaymentType is required field, so we don't need to clear validation
@@ -17411,7 +17478,7 @@
17411
17478
  if (bankAccount.isLoan()) {
17412
17479
  // Attach bank account to loan for LoanForm's logic
17413
17480
  // @TODO Alex/Vik: we should use separated API for bank accounts and loans
17414
- var loan = classTransformer.plainToClass(Loan, Object.assign(bankAccount.loan, { bankAccount: Object.assign(bankAccount, { loan: null }) }));
17481
+ var loan = classTransformer.plainToClass(Loan, Object.assign(bankAccount.loan, { bankAccount: { accountId: bankAccount.accountId } }));
17415
17482
  _this.addControl('loan', new LoanForm(loan));
17416
17483
  }
17417
17484
  // basiq account import form should be disabled (unchecked) by default