taxtank-core 0.31.7 → 0.31.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 (34) hide show
  1. package/esm2020/lib/db/Models/transaction/transaction-base.mjs +1 -1
  2. package/esm2020/lib/interfaces/document.interface.mjs +1 -1
  3. package/esm2020/lib/interfaces/index.mjs +1 -2
  4. package/esm2020/lib/models/bank/bank.mjs +10 -1
  5. package/esm2020/lib/models/depreciation/depreciation.mjs +2 -2
  6. package/esm2020/lib/models/firm/firm.mjs +1 -1
  7. package/esm2020/lib/models/property/property.mjs +1 -1
  8. package/esm2020/lib/models/registration-invite/registration-invite.mjs +1 -1
  9. package/esm2020/lib/models/sole/sole-business.mjs +1 -1
  10. package/esm2020/lib/models/sole/sole-contact.mjs +3 -3
  11. package/esm2020/lib/models/transaction/transaction.mjs +1 -1
  12. package/esm2020/lib/models/user/user.mjs +1 -1
  13. package/esm2020/lib/services/account-setup/account-setup.service.mjs +17 -39
  14. package/esm2020/lib/services/http/subscription/service-subscription/subscription.service.mjs +2 -2
  15. package/fesm2015/taxtank-core.mjs +23 -25
  16. package/fesm2015/taxtank-core.mjs.map +1 -1
  17. package/fesm2020/taxtank-core.mjs +23 -25
  18. package/fesm2020/taxtank-core.mjs.map +1 -1
  19. package/lib/db/Models/transaction/transaction-base.d.ts +1 -2
  20. package/lib/interfaces/document.interface.d.ts +3 -2
  21. package/lib/interfaces/index.d.ts +0 -1
  22. package/lib/models/bank/bank.d.ts +5 -2
  23. package/lib/models/depreciation/depreciation.d.ts +2 -3
  24. package/lib/models/firm/firm.d.ts +1 -2
  25. package/lib/models/property/property.d.ts +1 -2
  26. package/lib/models/registration-invite/registration-invite.d.ts +1 -2
  27. package/lib/models/sole/sole-business.d.ts +1 -2
  28. package/lib/models/sole/sole-contact.d.ts +3 -4
  29. package/lib/models/transaction/transaction.d.ts +2 -2
  30. package/lib/models/user/user.d.ts +1 -2
  31. package/lib/services/account-setup/account-setup.service.d.ts +5 -18
  32. package/package.json +1 -1
  33. package/esm2020/lib/interfaces/fileable.interface.mjs +0 -2
  34. package/lib/interfaces/fileable.interface.d.ts +0 -8
@@ -34,7 +34,6 @@ import { NavigationEnd } from '@angular/router';
34
34
  import _ from 'lodash';
35
35
  import merge from 'lodash/merge';
36
36
  import { loadStripe } from '@stripe/stripe-js';
37
- import fromPairs from 'lodash/fromPairs';
38
37
  import { jsPDF } from 'jspdf';
39
38
  import { applyPlugin } from 'jspdf-autotable';
40
39
  import html2pdf from 'html2pdf.js';
@@ -1403,6 +1402,15 @@ class Bank extends Bank$1 {
1403
1402
  isBasiq() {
1404
1403
  return this.provider !== BankProviderEnum.MANUAL;
1405
1404
  }
1405
+ /**
1406
+ * some images come from basiq (starting http), the rest from assets
1407
+ */
1408
+ getPhoto() {
1409
+ if (!this.logo) {
1410
+ return null;
1411
+ }
1412
+ return this.logo.includes('http') ? `${this.logo}` : `${localStorage.getItem('api_uri')}${this.logo}`;
1413
+ }
1406
1414
  }
1407
1415
  __decorate([
1408
1416
  Transform(({ value }) => value ? value.replace(' ', '%20') : null)
@@ -13863,7 +13871,7 @@ class SubscriptionService extends RestService$1 {
13863
13871
  // @TODO vik test and remove
13864
13872
  setTimeout(() => {
13865
13873
  this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED, null));
13866
- this.toastService.success('Subscription successfully updated');
13874
+ this.toastService.success('Subscription successfully updated!!!');
13867
13875
  }, 2000);
13868
13876
  });
13869
13877
  }
@@ -17768,8 +17776,7 @@ const ACCOUNT_SETUP_ITEMS = {
17768
17776
  * Checks required steps and their completion
17769
17777
  */
17770
17778
  class AccountSetupService {
17771
- constructor(clientIncomeTypesService, propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService, transactionService, soleBusinessService, holdingService, userService) {
17772
- this.clientIncomeTypesService = clientIncomeTypesService;
17779
+ constructor(propertyService, incomeSourceService, bankAccountsService, transactionAllocationService, vehicleClaimService, transactionService, soleBusinessService, holdingService, userService) {
17773
17780
  this.propertyService = propertyService;
17774
17781
  this.incomeSourceService = incomeSourceService;
17775
17782
  this.bankAccountsService = bankAccountsService;
@@ -17787,12 +17794,10 @@ class AccountSetupService {
17787
17794
  get() {
17788
17795
  if (!this.cache) {
17789
17796
  this.cache = new AccountSetupItemCollection([]);
17790
- this.clientIncomeTypesService.getFirst()
17791
- .pipe(mergeMap((incomeTypes) => {
17792
- this.clientIncomeTypesId = incomeTypes.id;
17793
- return this.createBatch(incomeTypes);
17794
- }))
17795
- .subscribe((items) => {
17797
+ this.userService.getFirst().pipe(mergeMap((user) => {
17798
+ this.user = user;
17799
+ return this.createBatch();
17800
+ })).subscribe((items) => {
17796
17801
  switch (true) {
17797
17802
  case !this.cache:
17798
17803
  case this.cache.filterBy('isCompleted', true).length !== items.filterBy('isCompleted', true).length:
@@ -17804,12 +17809,6 @@ class AccountSetupService {
17804
17809
  }
17805
17810
  return this.cacheSubject.asObservable();
17806
17811
  }
17807
- /**
17808
- * Prepare client income types to update to hide depended account setup items
17809
- */
17810
- prepareIncomeTypes(item) {
17811
- return plainToClass(ClientIncomeTypes, Object.assign({ id: this.clientIncomeTypesId }, fromPairs(item.clientIncomeTypes.map((type) => [type, false]))));
17812
- }
17813
17812
  /**
17814
17813
  * Get a single AccountSetupItem and check it's completion
17815
17814
  */
@@ -17829,28 +17828,27 @@ class AccountSetupService {
17829
17828
  * Get batch of requests to get list of required AccountSetupItem's.
17830
17829
  * Some items are optional and depends of user's client income types
17831
17830
  */
17832
- createBatch(incomeTypes) {
17831
+ createBatch() {
17833
17832
  const batch = [];
17834
- const user = this.userService.getCacheFirst();
17835
17833
  // Salary item is completed when user added salary income source
17836
- if (incomeTypes.work && user.hasRoles(UserRolesEnum.WORK_TANK)) {
17834
+ if (this.user.hasRoles(UserRolesEnum.WORK_TANK)) {
17837
17835
  batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSources(true)),
17838
17836
  // Other income is a part of work tank, completed when user added at least one other income source
17839
17837
  this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSources()));
17840
17838
  }
17841
17839
  // Rental income item is completed when user added at least one property
17842
- if (incomeTypes.property && user.hasRoles(UserRolesEnum.PROPERTY_TANK)) {
17840
+ if (this.user.hasRoles(UserRolesEnum.PROPERTY_TANK)) {
17843
17841
  batch.push(this.create(AccountSetupItemsEnum.PROPERTY, this.propertyService.getArray()));
17844
17842
  }
17845
17843
  // Sole business item is completed when user added at least one business
17846
- if (incomeTypes.sole && user.hasRoles(UserRolesEnum.SOLE_TANK)) {
17844
+ if (this.user.hasRoles(UserRolesEnum.SOLE_TANK)) {
17847
17845
  batch.push(this.create(AccountSetupItemsEnum.SOLE_BUSINESS, this.soleBusinessService.get()));
17848
17846
  }
17849
17847
  // holdings item is completed when user added at least one holding
17850
- if (incomeTypes.holdings && user.hasRoles(UserRolesEnum.HOLDING_TANK)) {
17848
+ if (this.user.hasRoles(UserRolesEnum.HOLDING_TANK)) {
17851
17849
  batch.push(this.create(AccountSetupItemsEnum.HOLDINGS, this.holdingService.getArray()));
17852
17850
  }
17853
- if (incomeTypes.sole || incomeTypes.property || incomeTypes.work || incomeTypes.holdings) {
17851
+ if (this.user.hasRoles([UserRolesEnum.WORK_TANK, UserRolesEnum.PROPERTY_TANK, UserRolesEnum.SOLE_TANK, UserRolesEnum.HOLDING_TANK])) {
17854
17852
  // Bank feeds item is completed when user added at least one bank account (basiq or manual)
17855
17853
  batch.push(this.getBankFeedsItem());
17856
17854
  // Logbook item is completed when user has at least one vehicle claim with any method (kms or logbook)
@@ -17899,14 +17897,14 @@ class AccountSetupService {
17899
17897
  return this.create(AccountSetupItemsEnum.BANK_FEEDS, this.bankAccountsService.getArray());
17900
17898
  }
17901
17899
  }
17902
- AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, deps: [{ token: ClientIncomeTypesService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: TransactionService }, { token: SoleBusinessService }, { token: HoldingService }, { token: UserService }], target: i0.ɵɵFactoryTarget.Injectable });
17900
+ AccountSetupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, deps: [{ token: PropertyService }, { token: IncomeSourceService }, { token: BankAccountService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: TransactionService }, { token: SoleBusinessService }, { token: HoldingService }, { token: UserService }], target: i0.ɵɵFactoryTarget.Injectable });
17903
17901
  AccountSetupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, providedIn: 'root' });
17904
17902
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AccountSetupService, decorators: [{
17905
17903
  type: Injectable,
17906
17904
  args: [{
17907
17905
  providedIn: 'root'
17908
17906
  }]
17909
- }], ctorParameters: function () { return [{ type: ClientIncomeTypesService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: TransactionService }, { type: SoleBusinessService }, { type: HoldingService }, { type: UserService }]; } });
17907
+ }], ctorParameters: function () { return [{ type: PropertyService }, { type: IncomeSourceService }, { type: BankAccountService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: TransactionService }, { type: SoleBusinessService }, { type: HoldingService }, { type: UserService }]; } });
17910
17908
 
17911
17909
  /**
17912
17910
  * Service to work with Rewardful (affiliate program) API