taxtank-core 0.16.10 → 0.16.13
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 +39 -96
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/collection-dictionary.js +16 -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 +38 -92
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/collection-dictionary.d.ts +5 -0
- 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
|
@@ -1188,6 +1188,22 @@
|
|
|
1188
1188
|
CollectionDictionary.prototype.length = function () {
|
|
1189
1189
|
return this.keys.length;
|
|
1190
1190
|
};
|
|
1191
|
+
/**
|
|
1192
|
+
* @Todo find a better solution to get list of the sorted keys
|
|
1193
|
+
* Get array of the "keys" by provided order
|
|
1194
|
+
*/
|
|
1195
|
+
CollectionDictionary.prototype.getSortedKeys = function (isDesc) {
|
|
1196
|
+
if (isDesc === void 0) { isDesc = false; }
|
|
1197
|
+
return this.keys.sort(function (a, b) {
|
|
1198
|
+
if (a > b) {
|
|
1199
|
+
return !isDesc ? 1 : -1;
|
|
1200
|
+
}
|
|
1201
|
+
if (a < b) {
|
|
1202
|
+
return !isDesc ? -1 : 1;
|
|
1203
|
+
}
|
|
1204
|
+
return 0;
|
|
1205
|
+
});
|
|
1206
|
+
};
|
|
1191
1207
|
/**
|
|
1192
1208
|
* Group collection items by passed path into items object
|
|
1193
1209
|
*/
|
|
@@ -2205,6 +2221,9 @@
|
|
|
2205
2221
|
IncomeSourceCollection.prototype.filterByTypes = function (types) {
|
|
2206
2222
|
return this.items.filter(function (incomeSource) { return types.includes(incomeSource.type); });
|
|
2207
2223
|
};
|
|
2224
|
+
IncomeSourceCollection.prototype.getSalary = function () {
|
|
2225
|
+
return this.items.filter(function (incomeSource) { return incomeSource.isSalaryIncome(); });
|
|
2226
|
+
};
|
|
2208
2227
|
Object.defineProperty(IncomeSourceCollection.prototype, "forecasts", {
|
|
2209
2228
|
/**
|
|
2210
2229
|
* Get income sources list of forecasts
|
|
@@ -4288,10 +4307,9 @@
|
|
|
4288
4307
|
|
|
4289
4308
|
exports.IncomeSourceTypeEnum = void 0;
|
|
4290
4309
|
(function (IncomeSourceTypeEnum) {
|
|
4291
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["
|
|
4292
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["
|
|
4310
|
+
IncomeSourceTypeEnum[IncomeSourceTypeEnum["WORK"] = 1] = "WORK";
|
|
4311
|
+
IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 2] = "SOLE";
|
|
4293
4312
|
IncomeSourceTypeEnum[IncomeSourceTypeEnum["OTHER"] = 3] = "OTHER";
|
|
4294
|
-
IncomeSourceTypeEnum[IncomeSourceTypeEnum["SOLE"] = 4] = "SOLE";
|
|
4295
4313
|
})(exports.IncomeSourceTypeEnum || (exports.IncomeSourceTypeEnum = {}));
|
|
4296
4314
|
|
|
4297
4315
|
var SalaryForecast$1 = /** @class */ (function (_super) {
|
|
@@ -4371,13 +4389,9 @@
|
|
|
4371
4389
|
return IncomeSourceType;
|
|
4372
4390
|
}(AbstractModel));
|
|
4373
4391
|
|
|
4374
|
-
var IncomeSourceTypeListSalaryEnum;
|
|
4375
|
-
(function (IncomeSourceTypeListSalaryEnum) {
|
|
4376
|
-
IncomeSourceTypeListSalaryEnum[IncomeSourceTypeListSalaryEnum["BONUSES"] = 1] = "BONUSES";
|
|
4377
|
-
})(IncomeSourceTypeListSalaryEnum || (IncomeSourceTypeListSalaryEnum = {}));
|
|
4378
|
-
|
|
4379
4392
|
exports.IncomeSourceTypeListWorkEnum = void 0;
|
|
4380
4393
|
(function (IncomeSourceTypeListWorkEnum) {
|
|
4394
|
+
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["BONUSES"] = 1] = "BONUSES";
|
|
4381
4395
|
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIRECTOR_FEES"] = 2] = "DIRECTOR_FEES";
|
|
4382
4396
|
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["DIVIDENDS"] = 3] = "DIVIDENDS";
|
|
4383
4397
|
IncomeSourceTypeListWorkEnum[IncomeSourceTypeListWorkEnum["INTEREST"] = 4] = "INTEREST";
|
|
@@ -4399,8 +4413,8 @@
|
|
|
4399
4413
|
function IncomeSourceType() {
|
|
4400
4414
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
4401
4415
|
}
|
|
4402
|
-
IncomeSourceType.prototype.
|
|
4403
|
-
return
|
|
4416
|
+
IncomeSourceType.prototype.isBonuses = function () {
|
|
4417
|
+
return this.id === exports.IncomeSourceTypeListWorkEnum.BONUSES;
|
|
4404
4418
|
};
|
|
4405
4419
|
IncomeSourceType.prototype.isWork = function () {
|
|
4406
4420
|
return !!exports.IncomeSourceTypeListWorkEnum[this.id];
|
|
@@ -4409,13 +4423,12 @@
|
|
|
4409
4423
|
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
4410
4424
|
};
|
|
4411
4425
|
IncomeSourceType.prototype.isSole = function () {
|
|
4426
|
+
// @TODO use IncomeSourceTypeListSoleEnum when sole tank ready
|
|
4412
4427
|
return !!exports.IncomeSourceTypeListOtherEnum[this.id];
|
|
4413
4428
|
};
|
|
4414
4429
|
Object.defineProperty(IncomeSourceType.prototype, "type", {
|
|
4415
4430
|
get: function () {
|
|
4416
4431
|
switch (true) {
|
|
4417
|
-
case this.isSalary():
|
|
4418
|
-
return exports.IncomeSourceTypeEnum.SALARY;
|
|
4419
4432
|
case this.isWork():
|
|
4420
4433
|
return exports.IncomeSourceTypeEnum.WORK;
|
|
4421
4434
|
case this.isSole():
|
|
@@ -4472,7 +4485,9 @@
|
|
|
4472
4485
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
4473
4486
|
}
|
|
4474
4487
|
IncomeSource.prototype.isSalaryIncome = function () {
|
|
4475
|
-
return this.
|
|
4488
|
+
return !!this.salaryForecasts.length;
|
|
4489
|
+
// @TODO Vik: old code
|
|
4490
|
+
// return this.type === IncomeSourceTypeEnum.SALARY;
|
|
4476
4491
|
};
|
|
4477
4492
|
IncomeSource.prototype.isSoleIncome = function () {
|
|
4478
4493
|
return this.type === exports.IncomeSourceTypeEnum.SOLE;
|
|
@@ -10101,11 +10116,11 @@
|
|
|
10101
10116
|
var batch = [];
|
|
10102
10117
|
// Salary item is completed when user added salary income source
|
|
10103
10118
|
if (incomeTypes.salary) {
|
|
10104
|
-
batch.push(this.create(AccountSetupItemsEnum.SALARY, this.
|
|
10119
|
+
batch.push(this.create(AccountSetupItemsEnum.SALARY, this.getIncomeSources(true)));
|
|
10105
10120
|
}
|
|
10106
10121
|
// Other income item is completed when user added at least one other income source
|
|
10107
10122
|
if (incomeTypes.dividends || incomeTypes.other) {
|
|
10108
|
-
batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.
|
|
10123
|
+
batch.push(this.create(AccountSetupItemsEnum.OTHER_INCOME, this.getIncomeSources()));
|
|
10109
10124
|
}
|
|
10110
10125
|
// Rental income item is completed when user added at least one property
|
|
10111
10126
|
if (incomeTypes.property) {
|
|
@@ -10130,11 +10145,17 @@
|
|
|
10130
10145
|
return rxjs.combineLatest(batch).pipe(operators.map(function (items) { return new AccountSetupItemCollection(items); }));
|
|
10131
10146
|
};
|
|
10132
10147
|
/**
|
|
10133
|
-
* @TODO work with collection when services refactored
|
|
10148
|
+
* @TODO Alex: work with collection when services refactored
|
|
10149
|
+
* @TODO Vik: waiting for income sources refactoring
|
|
10134
10150
|
*/
|
|
10135
|
-
AccountSetupService.prototype.
|
|
10151
|
+
AccountSetupService.prototype.getIncomeSources = function (isSalary) {
|
|
10152
|
+
if (isSalary === void 0) { isSalary = false; }
|
|
10136
10153
|
return this.incomeSourceService.get().pipe(operators.map(function (incomeSources) {
|
|
10137
|
-
|
|
10154
|
+
var collection = new IncomeSourceCollection(incomeSources);
|
|
10155
|
+
if (isSalary) {
|
|
10156
|
+
return collection.getSalary();
|
|
10157
|
+
}
|
|
10158
|
+
return collection.items.filter(function (incomeSource) { return !incomeSource.isSalaryIncome() && !incomeSource.isSoleIncome(); });
|
|
10138
10159
|
}));
|
|
10139
10160
|
};
|
|
10140
10161
|
/**
|
|
@@ -10484,14 +10505,6 @@
|
|
|
10484
10505
|
}]
|
|
10485
10506
|
}] });
|
|
10486
10507
|
|
|
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
10508
|
/**
|
|
10496
10509
|
* basiq is a middleman between bank and user
|
|
10497
10510
|
* service is responsible for fetching bank related information
|
|
@@ -10511,25 +10524,6 @@
|
|
|
10511
10524
|
BasiqService.prototype.listenEvents = function () {
|
|
10512
10525
|
this.listenToBankConnectionAdded();
|
|
10513
10526
|
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
10527
|
};
|
|
10534
10528
|
/**
|
|
10535
10529
|
* access token to use basiq connect ui iframe
|
|
@@ -10543,15 +10537,11 @@
|
|
|
10543
10537
|
return new BasiqToken(response['access_token'], new Date(now + response['expires_in'] * 1000));
|
|
10544
10538
|
}))
|
|
10545
10539
|
.subscribe(function (token) {
|
|
10546
|
-
_this.token = token;
|
|
10547
10540
|
_this.tokenSubject.next(token);
|
|
10548
10541
|
});
|
|
10549
10542
|
}
|
|
10550
10543
|
return this.tokenSubject.asObservable();
|
|
10551
10544
|
};
|
|
10552
|
-
/**
|
|
10553
|
-
* Get list of user's bank conections
|
|
10554
|
-
*/
|
|
10555
10545
|
BasiqService.prototype.getConnections = function () {
|
|
10556
10546
|
return this.get().pipe(operators.map(function (bankAccounts) {
|
|
10557
10547
|
// get all connections
|
|
@@ -10562,41 +10552,6 @@
|
|
|
10562
10552
|
return __spreadArray([], __read(new Map(connections.map(function (connection) { return [connection.id, connection]; })).values()));
|
|
10563
10553
|
}));
|
|
10564
10554
|
};
|
|
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
|
-
}, { once: true });
|
|
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
10555
|
/**
|
|
10601
10556
|
* Listen to EventDispatcherService event related to added Bank connection
|
|
10602
10557
|
*/
|
|
@@ -10621,18 +10576,6 @@
|
|
|
10621
10576
|
}
|
|
10622
10577
|
});
|
|
10623
10578
|
};
|
|
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
10579
|
return BasiqService;
|
|
10637
10580
|
}(RestService));
|
|
10638
10581
|
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 });
|