taxtank-core 0.16.10 → 0.16.11

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.
@@ -2205,6 +2205,9 @@
2205
2205
  IncomeSourceCollection.prototype.filterByTypes = function (types) {
2206
2206
  return this.items.filter(function (incomeSource) { return types.includes(incomeSource.type); });
2207
2207
  };
2208
+ IncomeSourceCollection.prototype.getSalary = function () {
2209
+ return this.items.filter(function (incomeSource) { return incomeSource.isSalaryIncome(); });
2210
+ };
2208
2211
  Object.defineProperty(IncomeSourceCollection.prototype, "forecasts", {
2209
2212
  /**
2210
2213
  * Get income sources list of forecasts
@@ -4288,10 +4291,9 @@
4288
4291
 
4289
4292
  exports.IncomeSourceTypeEnum = void 0;
4290
4293
  (function (IncomeSourceTypeEnum) {
4291
- IncomeSourceTypeEnum[IncomeSourceTypeEnum["SALARY"] = 1] = "SALARY";
4292
- IncomeSourceTypeEnum[IncomeSourceTypeEnum["WORK"] = 2] = "WORK";
4294
+ IncomeSourceTypeEnum[IncomeSourceTypeEnum["WORK"] = 1] = "WORK";
4295
+ IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 2] = "SOLE";
4293
4296
  IncomeSourceTypeEnum[IncomeSourceTypeEnum["OTHER"] = 3] = "OTHER";
4294
- IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 4] = "SOLE";
4295
4297
  })(exports.IncomeSourceTypeEnum || (exports.IncomeSourceTypeEnum = {}));
4296
4298
 
4297
4299
  var SalaryForecast$1 = /** @class */ (function (_super) {
@@ -4371,13 +4373,9 @@
4371
4373
  return IncomeSourceType;
4372
4374
  }(AbstractModel));
4373
4375
 
4374
- var IncomeSourceTypeListSalaryEnum;
4375
- (function (IncomeSourceTypeListSalaryEnum) {
4376
- IncomeSourceTypeListSalaryEnum[IncomeSourceTypeListSalaryEnum["BONUSES"] = 1] = "BONUSES";
4377
- })(IncomeSourceTypeListSalaryEnum || (IncomeSourceTypeListSalaryEnum = {}));
4378
-
4379
4376
  exports.IncomeSourceTypeListWorkEnum = void 0;
4380
4377
  (function (IncomeSourceTypeListWorkEnum) {
4378
+ IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["BONUSES"] = 1] = "BONUSES";
4381
4379
  IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIRECTOR_FEES"] = 2] = "DIRECTOR_FEES";
4382
4380
  IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIVIDENDS"] = 3] = "DIVIDENDS";
4383
4381
  IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["INTEREST"] = 4] = "INTEREST";
@@ -4399,8 +4397,8 @@
4399
4397
  function IncomeSourceType() {
4400
4398
  return _super !== null && _super.apply(this, arguments) || this;
4401
4399
  }
4402
- IncomeSourceType.prototype.isSalary = function () {
4403
- return !!IncomeSourceTypeListSalaryEnum[this.id];
4400
+ IncomeSourceType.prototype.isBonuses = function () {
4401
+ return this.id === exports.IncomeSourceTypeListWorkEnum.BONUSES;
4404
4402
  };
4405
4403
  IncomeSourceType.prototype.isWork = function () {
4406
4404
  return !!exports.IncomeSourceTypeListWorkEnum[this.id];
@@ -4409,13 +4407,12 @@
4409
4407
  return !!exports.IncomeSourceTypeListOtherEnum[this.id];
4410
4408
  };
4411
4409
  IncomeSourceType.prototype.isSole = function () {
4410
+ // @TODO use IncomeSourceTypeListSoleEnum when sole tank ready
4412
4411
  return !!exports.IncomeSourceTypeListOtherEnum[this.id];
4413
4412
  };
4414
4413
  Object.defineProperty(IncomeSourceType.prototype, "type", {
4415
4414
  get: function () {
4416
4415
  switch (true) {
4417
- case this.isSalary():
4418
- return exports.IncomeSourceTypeEnum.SALARY;
4419
4416
  case this.isWork():
4420
4417
  return exports.IncomeSourceTypeEnum.WORK;
4421
4418
  case this.isSole():
@@ -4472,7 +4469,9 @@
4472
4469
  return _super !== null && _super.apply(this, arguments) || this;
4473
4470
  }
4474
4471
  IncomeSource.prototype.isSalaryIncome = function () {
4475
- return this.type === exports.IncomeSourceTypeEnum.SALARY;
4472
+ return !!this.salaryForecasts.length;
4473
+ // @TODO Vik: old code
4474
+ // return this.type === IncomeSourceTypeEnum.SALARY;
4476
4475
  };
4477
4476
  IncomeSource.prototype.isSoleIncome = function () {
4478
4477
  return this.type === exports.IncomeSourceTypeEnum.SOLE;
@@ -10101,11 +10100,11 @@
10101
10100
  var batch = [];
10102
10101
  // Salary item is completed when user added salary income source
10103
10102
  if (incomeTypes.salary) {
10104
- batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSourcesByType(exports.IncomeSourceTypeEnum.WORK)));
10103
+ batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSources(true)));
10105
10104
  }
10106
10105
  // Other income item is completed when user added at least one other income source
10107
10106
  if (incomeTypes.dividends || incomeTypes.other) {
10108
- batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSourcesByType(exports.IncomeSourceTypeEnum.OTHER)));
10107
+ batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSources()));
10109
10108
  }
10110
10109
  // Rental income item is completed when user added at least one property
10111
10110
  if (incomeTypes.property) {
@@ -10130,11 +10129,17 @@
10130
10129
  return rxjs.combineLatest(batch).pipe(operators.map(function (items) { return new AccountSetupItemCollection(items); }));
10131
10130
  };
10132
10131
  /**
10133
- * @TODO work with collection when services refactored
10132
+ * @TODO Alex: work with collection when services refactored
10133
+ * @TODO Vik: waiting for income sources refactoring
10134
10134
  */
10135
- AccountSetupService.prototype.getIncomeSourcesByType = function (type) {
10135
+ AccountSetupService.prototype.getIncomeSources = function (isSalary) {
10136
+ if (isSalary === void 0) { isSalary = false; }
10136
10137
  return this.incomeSourceService.get().pipe(operators.map(function (incomeSources) {
10137
- return new IncomeSourceCollection(incomeSources).getBy('type', type).toArray();
10138
+ var collection = new IncomeSourceCollection(incomeSources);
10139
+ if (isSalary) {
10140
+ return collection.getSalary();
10141
+ }
10142
+ return collection.items.filter(function (incomeSource) { return !incomeSource.isSalaryIncome() && !incomeSource.isSoleIncome(); });
10138
10143
  }));
10139
10144
  };
10140
10145
  /**