taxtank-core 1.0.35 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5440,7 +5440,7 @@ var AccountSetupItemsEnum;
5440
5440
  AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_HOME_OFFICE"] = 21] = "SOLE_HOME_OFFICE";
5441
5441
  AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_DEPRECIATION"] = 22] = "SOLE_DEPRECIATION";
5442
5442
  AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_BANK_ACCOUNT"] = 23] = "SOLE_BANK_ACCOUNT";
5443
- AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_LOGO"] = 24] = "SOLE_LOGO";
5443
+ AccountSetupItemsEnum[AccountSetupItemsEnum["SOLE_LOGO"] = 16] = "SOLE_LOGO";
5444
5444
  // holding
5445
5445
  AccountSetupItemsEnum[AccountSetupItemsEnum["HOLDING_TRADE"] = 8] = "HOLDING_TRADE";
5446
5446
  AccountSetupItemsEnum[AccountSetupItemsEnum["HOLDING_INTEGRATION"] = 25] = "HOLDING_INTEGRATION";
@@ -5448,6 +5448,7 @@ var AccountSetupItemsEnum;
5448
5448
  // bank accounts
5449
5449
  AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_CONNECTION"] = 4] = "BANK_CONNECTION";
5450
5450
  AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_ACCOUNT"] = 26] = "BANK_ACCOUNT";
5451
+ AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_TRANSACTION"] = 24] = "BANK_TRANSACTION";
5451
5452
  AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_ALLOCATION"] = 6] = "BANK_ALLOCATION";
5452
5453
  AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_RULE"] = 27] = "BANK_RULE";
5453
5454
  AccountSetupItemsEnum[AccountSetupItemsEnum["BANK_BORROWING_EXPENSE"] = 28] = "BANK_BORROWING_EXPENSE";
@@ -19334,12 +19335,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImpor
19334
19335
  * Checks required steps and their completion
19335
19336
  */
19336
19337
  class AccountSetupService {
19337
- constructor(setupItemService, propertyService, incomeSourceService, bankConnectionService, bankAccountsService, loanService, allocationRuleService, transactionAllocationService, vehicleClaimService, homeOfficeClaimService, transactionService, depreciationService, businessService, holdingService, userService, clientMovementService, clientInviteService, employeeService, employeeInviteService, firmService, sharesightDetailsService, propertyShareService) {
19338
+ constructor(setupItemService, propertyService, incomeSourceService, bankConnectionService, bankAccountsService, bankTransactionService, loanService, allocationRuleService, transactionAllocationService, vehicleClaimService, homeOfficeClaimService, transactionService, depreciationService, businessService, holdingService, userService, clientMovementService, clientInviteService, employeeService, employeeInviteService, firmService, sharesightDetailsService, propertyShareService) {
19338
19339
  this.setupItemService = setupItemService;
19339
19340
  this.propertyService = propertyService;
19340
19341
  this.incomeSourceService = incomeSourceService;
19341
19342
  this.bankConnectionService = bankConnectionService;
19342
19343
  this.bankAccountsService = bankAccountsService;
19344
+ this.bankTransactionService = bankTransactionService;
19343
19345
  this.loanService = loanService;
19344
19346
  this.allocationRuleService = allocationRuleService;
19345
19347
  this.transactionAllocationService = transactionAllocationService;
@@ -19361,15 +19363,15 @@ class AccountSetupService {
19361
19363
  /**
19362
19364
  * Get list of account setup items for current user/firm
19363
19365
  */
19364
- get(property, business) {
19366
+ get(property, business, bankAccount) {
19365
19367
  // @TODO it takes time for user to update, makes sense to subscribe to serviceSubscription instead
19366
19368
  return combineLatest([this.setupItemService.get(), this.userService.getFirst()]).pipe(switchMap(([items, user]) => {
19367
19369
  this.user = user;
19368
19370
  this.items = items.getByUser(user);
19369
- return this.setItemsStatus(property, business);
19371
+ return this.setItemsStatus(property, business, bankAccount);
19370
19372
  }));
19371
19373
  }
19372
- setItemsStatus(property, business) {
19374
+ setItemsStatus(property, business, bankAccount) {
19373
19375
  const itemsById = this.items.indexBy('id');
19374
19376
  const requests = pick({
19375
19377
  // firm
@@ -19391,35 +19393,41 @@ class AccountSetupService {
19391
19393
  [AccountSetupItemsEnum.SOLE_BUSINESS]: this.businessService.getArray(),
19392
19394
  [AccountSetupItemsEnum.SOLE_BUSINESSES]: this.businessService.getArray().pipe(map(businesses => businesses.slice(1))),
19393
19395
  [AccountSetupItemsEnum.SOLE_BANK_ACCOUNT]: this.getBankAccounts(TankTypeEnum.SOLE),
19394
- // holding
19396
+ // holdings
19395
19397
  [AccountSetupItemsEnum.HOLDING_TRADE]: this.holdingService.getArray(),
19396
19398
  [AccountSetupItemsEnum.HOLDING_INTEGRATION]: this.getSharesightDetails(true),
19397
- // bankAccount
19399
+ // bankAccounts
19398
19400
  [AccountSetupItemsEnum.BANK_CONNECTION]: this.bankConnectionService.getArray(),
19399
19401
  [AccountSetupItemsEnum.BANK_ACCOUNT]: this.getBankAccounts(),
19400
- [AccountSetupItemsEnum.BANK_ALLOCATION]: this.transactionAllocationService.get(),
19401
- [AccountSetupItemsEnum.BANK_RULE]: this.allocationRuleService.getArray(),
19402
- [AccountSetupItemsEnum.BANK_BORROWING_EXPENSE]: this.getBorrowingExpenses(),
19403
19402
  }, this.items.getIds());
19404
19403
  // property
19405
19404
  if (property) {
19406
19405
  requests[AccountSetupItemsEnum.PROPERTY_CAPITAL_COST] = this.propertyService.getBy('id', property.id).pipe(map(properties => properties.filter(property => !!property.capitalCosts)));
19407
- requests[AccountSetupItemsEnum.PROPERTY_RENT_INCOME] = this.getTransactions(property).pipe(map(transactions => new TransactionCollection(transactions).filterBy('chartAccounts.id', ChartAccountsListEnum.RENTAL_INCOME)));
19406
+ requests[AccountSetupItemsEnum.PROPERTY_RENT_INCOME] = this.getTransactions(property.id).pipe(map(transactions => new TransactionCollection(transactions).filterBy('chartAccounts.id', ChartAccountsListEnum.RENTAL_INCOME)));
19408
19407
  requests[AccountSetupItemsEnum.PROPERTY_DEPRECIATION] = this.getDepreciations(TankTypeEnum.PROPERTY, property.id);
19409
- requests[AccountSetupItemsEnum.PROPERTY_CO_OWNER] = this.getCoOwners(property);
19408
+ requests[AccountSetupItemsEnum.PROPERTY_CO_OWNER] = this.getCoOwners(property.id);
19410
19409
  }
19411
19410
  // business
19412
19411
  if (business) {
19413
- requests[AccountSetupItemsEnum.SOLE_VEHICLE_CLAIM] = this.getVehicleClaims(business);
19414
- requests[AccountSetupItemsEnum.SOLE_HOME_OFFICE] = this.getHomeOfficeClaims(business);
19412
+ requests[AccountSetupItemsEnum.SOLE_VEHICLE_CLAIM] = this.getVehicleClaims(business.id);
19413
+ requests[AccountSetupItemsEnum.SOLE_HOME_OFFICE] = this.getHomeOfficeClaims(business.id);
19415
19414
  requests[AccountSetupItemsEnum.SOLE_DEPRECIATION] = this.getDepreciations(TankTypeEnum.SOLE, business.id);
19416
19415
  requests[AccountSetupItemsEnum.SOLE_LOGO] = this.businessService.getBy('id', business.id).pipe(map(businesses => businesses.filter(business => !!business.file)));
19417
19416
  }
19417
+ // bankAccount
19418
+ if (bankAccount) {
19419
+ requests[AccountSetupItemsEnum.BANK_TRANSACTION] = this.bankTransactionService.get().pipe(map(transactions => transactions.filterBy('bankAccount.id', bankAccount.id)));
19420
+ requests[AccountSetupItemsEnum.BANK_ALLOCATION] = this.getAllocations(bankAccount.id);
19421
+ requests[AccountSetupItemsEnum.BANK_RULE] = this.allocationRuleService.get().pipe(map(rules => rules.filterBy('bankAccount.id', bankAccount.id)));
19422
+ if (bankAccount.loan) {
19423
+ requests[AccountSetupItemsEnum.BANK_BORROWING_EXPENSE] = this.loanService.get().pipe(map(loans => loans.filterBy('bankAccount.id', bankAccount.id).filter(loan => !!loan.borrowingExpenses.length)));
19424
+ }
19425
+ }
19418
19426
  const batch = Object.keys(requests).map(id => this.setItemStatus(itemsById.get(id), requests[id]));
19419
19427
  if (!batch.length) {
19420
19428
  return of(new AccountSetupItemCollection([]));
19421
19429
  }
19422
- return combineLatest(batch).pipe(map((items) => new AccountSetupItemCollection(items)));
19430
+ return combineLatest(batch).pipe(map((items) => new AccountSetupItemCollection(items).sortBy('order', 'asc')));
19423
19431
  }
19424
19432
  /**
19425
19433
  * Check and update isCompleted flag for passed item
@@ -19431,11 +19439,17 @@ class AccountSetupService {
19431
19439
  return item;
19432
19440
  }));
19433
19441
  }
19434
- getTransactions(property) {
19435
- return this.transactionService.getByPropertyId(property.id);
19442
+ getAllocations(bankAccountId) {
19443
+ return combineLatest([this.bankTransactionService.get(), this.transactionAllocationService.get()]).pipe(map(([bankTransactions, allocations]) => {
19444
+ const bankTransactionsIds = bankTransactions.filterBy('bankAccount.id', bankAccountId).getIds();
19445
+ return new TransactionAllocationCollection(allocations).getByBankTransactionsIds(bankTransactionsIds).toArray();
19446
+ }));
19436
19447
  }
19437
- getCoOwners(property) {
19438
- return this.propertyShareService.getArrayBy('property.id', property.id).pipe(map(shares => shares.slice(1)));
19448
+ getTransactions(propertyId) {
19449
+ return this.transactionService.getByPropertyId(propertyId);
19450
+ }
19451
+ getCoOwners(propertyId) {
19452
+ return this.propertyShareService.getArrayBy('property.id', propertyId).pipe(map(shares => shares.slice(1)));
19439
19453
  }
19440
19454
  /**
19441
19455
  * AccountSetupItemsEnum.FIRM_CLIENTS completed when client invites sent or accepted
@@ -19468,11 +19482,11 @@ class AccountSetupService {
19468
19482
  return collection.items.filter((incomeSource) => incomeSource.isOtherIncome());
19469
19483
  }));
19470
19484
  }
19471
- getVehicleClaims(business) {
19472
- return this.vehicleClaimService.getArray().pipe(map(claims => claims.filter(claim => business ? claim.business.id === business.id : !claim.business)));
19485
+ getVehicleClaims(businessId) {
19486
+ return this.vehicleClaimService.getArray().pipe(map(claims => claims.filter(claim => claim.business?.id === businessId)));
19473
19487
  }
19474
- getHomeOfficeClaims(business) {
19475
- return this.homeOfficeClaimService.getArray().pipe(map(claims => claims.filter(claim => business ? claim.business.id === business.id : !claim.business)));
19488
+ getHomeOfficeClaims(businessId) {
19489
+ return this.homeOfficeClaimService.getArray().pipe(map(claims => claims.filter(claim => claim.business?.id === businessId)));
19476
19490
  }
19477
19491
  getBankAccounts(tankType) {
19478
19492
  return this.bankAccountsService.get().pipe(map((bankAccounts => bankAccounts.getByTankType(tankType).toArray())));
@@ -19492,10 +19506,7 @@ class AccountSetupService {
19492
19506
  getSharesightDetails(importEnabled) {
19493
19507
  return this.sharesightDetailsService.getArray().pipe(map(details => details.filter(detail => importEnabled ? detail.importEnabled : detail.exportEnabled)));
19494
19508
  }
19495
- getBorrowingExpenses() {
19496
- return this.loanService.getArray().pipe(map(loans => loans.filter(loan => !!loan.borrowingExpenses.length)));
19497
- }
19498
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: AccountSetupService, deps: [{ token: SetupItemService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankConnectionService }, { token: BankAccountService }, { token: LoanService }, { token: AllocationRuleService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: HomeOfficeClaimService }, { token: TransactionService }, { token: DepreciationService }, { token: SoleBusinessService }, { token: HoldingTradeService }, { token: UserService }, { token: ClientMovementService }, { token: ClientInviteService }, { token: EmployeeService }, { token: EmployeeInviteService }, { token: FirmService }, { token: SharesightDetailsService }, { token: PropertyShareService }], target: i0.ɵɵFactoryTarget.Injectable }); }
19509
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: AccountSetupService, deps: [{ token: SetupItemService }, { token: PropertyService }, { token: IncomeSourceService }, { token: BankConnectionService }, { token: BankAccountService }, { token: BankTransactionService }, { token: LoanService }, { token: AllocationRuleService }, { token: TransactionAllocationService }, { token: VehicleClaimService }, { token: HomeOfficeClaimService }, { token: TransactionService }, { token: DepreciationService }, { token: SoleBusinessService }, { token: HoldingTradeService }, { token: UserService }, { token: ClientMovementService }, { token: ClientInviteService }, { token: EmployeeService }, { token: EmployeeInviteService }, { token: FirmService }, { token: SharesightDetailsService }, { token: PropertyShareService }], target: i0.ɵɵFactoryTarget.Injectable }); }
19499
19510
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: AccountSetupService, providedIn: 'root' }); }
19500
19511
  }
19501
19512
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImport: i0, type: AccountSetupService, decorators: [{
@@ -19503,7 +19514,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.2", ngImpor
19503
19514
  args: [{
19504
19515
  providedIn: 'root'
19505
19516
  }]
19506
- }], ctorParameters: () => [{ type: SetupItemService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankConnectionService }, { type: BankAccountService }, { type: LoanService }, { type: AllocationRuleService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: HomeOfficeClaimService }, { type: TransactionService }, { type: DepreciationService }, { type: SoleBusinessService }, { type: HoldingTradeService }, { type: UserService }, { type: ClientMovementService }, { type: ClientInviteService }, { type: EmployeeService }, { type: EmployeeInviteService }, { type: FirmService }, { type: SharesightDetailsService }, { type: PropertyShareService }] });
19517
+ }], ctorParameters: () => [{ type: SetupItemService }, { type: PropertyService }, { type: IncomeSourceService }, { type: BankConnectionService }, { type: BankAccountService }, { type: BankTransactionService }, { type: LoanService }, { type: AllocationRuleService }, { type: TransactionAllocationService }, { type: VehicleClaimService }, { type: HomeOfficeClaimService }, { type: TransactionService }, { type: DepreciationService }, { type: SoleBusinessService }, { type: HoldingTradeService }, { type: UserService }, { type: ClientMovementService }, { type: ClientInviteService }, { type: EmployeeService }, { type: EmployeeInviteService }, { type: FirmService }, { type: SharesightDetailsService }, { type: PropertyShareService }] });
19507
19518
 
19508
19519
  class AdblockService {
19509
19520
  constructor() {
@@ -21103,14 +21114,18 @@ var YoutubeVideosEnum;
21103
21114
  YoutubeVideosEnum["PROPERTY_ONBOARDING"] = "llUV98-EMdI";
21104
21115
  YoutubeVideosEnum["SOLE_ONBOARDING"] = "rqfTQFGwkUM";
21105
21116
  YoutubeVideosEnum["WORK_ONBOARDING"] = "QEKolzS1B0U";
21106
- // @TODO replace
21107
21117
  YoutubeVideosEnum["PROPERTY_RENTAL"] = "E9NU14ndjhc";
21108
- YoutubeVideosEnum["PROPERTY_DEPRECIATION"] = "E9NU14ndjhc";
21109
- YoutubeVideosEnum["SOLE_VEHICLE_CLAIM"] = "E9NU14ndjhc";
21110
- YoutubeVideosEnum["HOME_OFFICE"] = "E9NU14ndjhc";
21111
- YoutubeVideosEnum["SOLE_DEPRECIATION"] = "E9NU14ndjhc";
21112
- YoutubeVideosEnum["WORK_VEHICLE_CLAIM"] = "E9NU14ndjhc";
21113
- YoutubeVideosEnum["WORK_DEPRECIATION"] = "E9NU14ndjhc";
21118
+ YoutubeVideosEnum["PROPERTY_DEPRECIATION"] = "_34lK9ooFzc";
21119
+ YoutubeVideosEnum["VEHICLE_CLAIM"] = "4-6WaM83cw0";
21120
+ YoutubeVideosEnum["SOLE_DEPRECIATION"] = "Bw3tx4miFF8";
21121
+ YoutubeVideosEnum["SOLE_HOME_OFFICE"] = "fF8_kJHEKRE";
21122
+ YoutubeVideosEnum["WORK_DEPRECIATION"] = "gNa9M4xovuI";
21123
+ YoutubeVideosEnum["WORK_HOME_OFFICE"] = "qrQu4Yl72bU";
21124
+ YoutubeVideosEnum["BANK_FEEDS"] = "meQmpw7ZY7c";
21125
+ // @TODO replace PROPERTY_RENTAL
21126
+ YoutubeVideosEnum["BANK_ACCOUNT_TRANSACTION"] = "meQmpw7ZY7c";
21127
+ YoutubeVideosEnum["BANK_ALLOCATION_RULE"] = "meQmpw7ZY7c";
21128
+ YoutubeVideosEnum["ALLOCATE_TRANSACTION"] = "meQmpw7ZY7c";
21114
21129
  })(YoutubeVideosEnum || (YoutubeVideosEnum = {}));
21115
21130
 
21116
21131
  var PropertyDepreciationCalculationEnum;