taxtank-core 0.16.9 → 0.16.12
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.
- package/bundles/taxtank-core.umd.js +23 -96
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/income-source.collection.js +4 -1
- package/esm2015/lib/db/Enums/income-source-type-list-other.enum.js +1 -1
- package/esm2015/lib/db/Enums/income-source-type-list-work.enum.js +2 -1
- package/esm2015/lib/db/Enums/income-source-type.enum.js +3 -4
- package/esm2015/lib/models/income-source/income-source-type.js +4 -6
- package/esm2015/lib/models/income-source/income-source.js +4 -2
- package/esm2015/lib/services/account-setup/account-setup.service.js +11 -7
- package/esm2015/lib/services/http/bank/basiq/basiq.service.js +5 -79
- package/fesm2015/taxtank-core.js +23 -92
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/income-source.collection.d.ts +1 -0
- package/lib/db/Enums/income-source-type-list-work.enum.d.ts +1 -0
- package/lib/db/Enums/income-source-type.enum.d.ts +3 -4
- package/lib/models/income-source/income-source-type.d.ts +1 -1
- package/lib/services/account-setup/account-setup.service.d.ts +3 -2
- package/lib/services/http/bank/basiq/basiq.service.d.ts +2 -29
- package/package.json +1 -1
- package/esm2015/lib/db/Enums/income-source-type-list-salary.enum.js +0 -5
- package/lib/db/Enums/income-source-type-list-salary.enum.d.ts +0 -3
|
@@ -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["
|
|
4292
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["
|
|
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.
|
|
4403
|
-
return
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
/**
|
|
@@ -10484,14 +10489,6 @@
|
|
|
10484
10489
|
}]
|
|
10485
10490
|
}] });
|
|
10486
10491
|
|
|
10487
|
-
/**
|
|
10488
|
-
* Basiq consent UI initial URL. Replace USER_ID and TOKEN by user data + handle action parameter
|
|
10489
|
-
*/
|
|
10490
|
-
var BASIQ_CONSENT_URL = 'https://consent.basiq.io/home?userId=USER_ID&token=TOKEN&action=connect';
|
|
10491
|
-
/**
|
|
10492
|
-
* Event message name we listen to handle basiq UI result
|
|
10493
|
-
*/
|
|
10494
|
-
var FINISH_BASIQ_EVENT = 'finish-basiq';
|
|
10495
10492
|
/**
|
|
10496
10493
|
* basiq is a middleman between bank and user
|
|
10497
10494
|
* service is responsible for fetching bank related information
|
|
@@ -10511,25 +10508,6 @@
|
|
|
10511
10508
|
BasiqService.prototype.listenEvents = function () {
|
|
10512
10509
|
this.listenToBankConnectionAdded();
|
|
10513
10510
|
this.listenNotifications();
|
|
10514
|
-
this.listenBasiqConcentUpdated();
|
|
10515
|
-
};
|
|
10516
|
-
/**
|
|
10517
|
-
* Update user's basiq consents data on backend
|
|
10518
|
-
*/
|
|
10519
|
-
BasiqService.prototype.confirmConsents = function () {
|
|
10520
|
-
var _this = this;
|
|
10521
|
-
return this.http.put(this.environment.apiV2 + "/basiq/consents", {}).pipe(operators.map(function (isConfirmed) {
|
|
10522
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED, isConfirmed));
|
|
10523
|
-
}));
|
|
10524
|
-
};
|
|
10525
|
-
/**
|
|
10526
|
-
* Notify backend to update connections
|
|
10527
|
-
*/
|
|
10528
|
-
BasiqService.prototype.updateConnections = function () {
|
|
10529
|
-
var _this = this;
|
|
10530
|
-
return this.http.post(this.environment.apiV2 + "/basiq/connections", {}).pipe(operators.map(function (connections) {
|
|
10531
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.BASIQ_CONNECTION_UPDATED, !!connections));
|
|
10532
|
-
}));
|
|
10533
10511
|
};
|
|
10534
10512
|
/**
|
|
10535
10513
|
* access token to use basiq connect ui iframe
|
|
@@ -10543,15 +10521,11 @@
|
|
|
10543
10521
|
return new BasiqToken(response['access_token'], new Date(now + response['expires_in'] * 1000));
|
|
10544
10522
|
}))
|
|
10545
10523
|
.subscribe(function (token) {
|
|
10546
|
-
_this.token = token;
|
|
10547
10524
|
_this.tokenSubject.next(token);
|
|
10548
10525
|
});
|
|
10549
10526
|
}
|
|
10550
10527
|
return this.tokenSubject.asObservable();
|
|
10551
10528
|
};
|
|
10552
|
-
/**
|
|
10553
|
-
* Get list of user's bank conections
|
|
10554
|
-
*/
|
|
10555
10529
|
BasiqService.prototype.getConnections = function () {
|
|
10556
10530
|
return this.get().pipe(operators.map(function (bankAccounts) {
|
|
10557
10531
|
// get all connections
|
|
@@ -10562,41 +10536,6 @@
|
|
|
10562
10536
|
return __spreadArray([], __read(new Map(connections.map(function (connection) { return [connection.id, connection]; })).values()));
|
|
10563
10537
|
}));
|
|
10564
10538
|
};
|
|
10565
|
-
/**
|
|
10566
|
-
* Listen response from basiq UI to handle result.
|
|
10567
|
-
* @param isBasiqConsentExist flag from User.ClientDetails - true if user confirmed basiq consent
|
|
10568
|
-
* @param callback function we run after basiq UI work is finished
|
|
10569
|
-
*/
|
|
10570
|
-
BasiqService.prototype.listenBasiqResponse = function (isBasiqConsentExist, callback) {
|
|
10571
|
-
var _this = this;
|
|
10572
|
-
window.addEventListener('message', function (message) {
|
|
10573
|
-
if (message.data !== FINISH_BASIQ_EVENT) {
|
|
10574
|
-
return;
|
|
10575
|
-
}
|
|
10576
|
-
// update user's basiq consent confirmation status for the first basiq ui run
|
|
10577
|
-
if (isBasiqConsentExist) {
|
|
10578
|
-
_this.updateConnections().pipe(operators.take(1)).subscribe();
|
|
10579
|
-
}
|
|
10580
|
-
else {
|
|
10581
|
-
_this.confirmConsents().pipe(operators.take(1)).subscribe();
|
|
10582
|
-
}
|
|
10583
|
-
callback();
|
|
10584
|
-
});
|
|
10585
|
-
};
|
|
10586
|
-
/**
|
|
10587
|
-
* Get URL with filled params to run basiq UI iframe
|
|
10588
|
-
*/
|
|
10589
|
-
BasiqService.prototype.generateBasiqConsentUrl = function (user) {
|
|
10590
|
-
return this.getToken().pipe(operators.map(function (token) {
|
|
10591
|
-
var url = BASIQ_CONSENT_URL;
|
|
10592
|
-
url = url.replace('USER_ID', user.basiqId);
|
|
10593
|
-
url = url.replace('TOKEN', token.value);
|
|
10594
|
-
if (!user.clientDetails.basiqConsentExist) {
|
|
10595
|
-
url = url.split('&action')[0];
|
|
10596
|
-
}
|
|
10597
|
-
return url;
|
|
10598
|
-
}));
|
|
10599
|
-
};
|
|
10600
10539
|
/**
|
|
10601
10540
|
* Listen to EventDispatcherService event related to added Bank connection
|
|
10602
10541
|
*/
|
|
@@ -10621,18 +10560,6 @@
|
|
|
10621
10560
|
}
|
|
10622
10561
|
});
|
|
10623
10562
|
};
|
|
10624
|
-
/**
|
|
10625
|
-
* Update user's basiq connections when user confirmed basiq consent
|
|
10626
|
-
*/
|
|
10627
|
-
BasiqService.prototype.listenBasiqConcentUpdated = function () {
|
|
10628
|
-
var _this = this;
|
|
10629
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(function (isConfirmed) {
|
|
10630
|
-
if (!isConfirmed) {
|
|
10631
|
-
return;
|
|
10632
|
-
}
|
|
10633
|
-
_this.updateConnections().pipe(operators.take(1)).subscribe();
|
|
10634
|
-
});
|
|
10635
|
-
};
|
|
10636
10563
|
return BasiqService;
|
|
10637
10564
|
}(RestService));
|
|
10638
10565
|
BasiqService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: BasiqService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|