taxtank-core 0.21.12 → 0.21.15
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 +77 -26
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/property/property.collection.js +2 -8
- package/esm2015/lib/forms/bank/bank-account/bank-account-properties.form.js +4 -3
- package/esm2015/lib/models/property/property.js +5 -1
- package/esm2015/lib/models/transaction/transaction.js +4 -1
- package/esm2015/lib/services/http/transaction/transaction.service.js +5 -3
- package/esm2015/lib/services/http/tutorial-video/tutorial-video-response.interface.js +2 -0
- package/esm2015/lib/services/http/tutorial-video/tutorial-video.service.js +29 -0
- package/esm2015/lib/services/http/tutorial-video/video-source.interface.js +5 -0
- package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +31 -8
- package/esm2015/public-api.js +3 -1
- package/fesm2015/taxtank-core.js +75 -19
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/property/property.collection.d.ts +0 -2
- package/lib/models/property/property.d.ts +1 -0
- package/lib/models/transaction/transaction.d.ts +1 -0
- package/lib/services/http/tutorial-video/tutorial-video-response.interface.d.ts +4 -0
- package/lib/services/http/tutorial-video/tutorial-video.service.d.ts +14 -0
- package/lib/services/http/tutorial-video/video-source.interface.d.ts +8 -0
- package/lib/services/property/property-calculation/property-calculation.service.d.ts +8 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -2991,6 +2991,14 @@
|
|
|
2991
2991
|
enumerable: false,
|
|
2992
2992
|
configurable: true
|
|
2993
2993
|
});
|
|
2994
|
+
Object.defineProperty(Property.prototype, "forecastedCashPosition", {
|
|
2995
|
+
get: function () {
|
|
2996
|
+
var _a;
|
|
2997
|
+
return ((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.cashPosition) || 0;
|
|
2998
|
+
},
|
|
2999
|
+
enumerable: false,
|
|
3000
|
+
configurable: true
|
|
3001
|
+
});
|
|
2994
3002
|
Object.defineProperty(Property.prototype, "firstForecastYear", {
|
|
2995
3003
|
get: function () {
|
|
2996
3004
|
return this.forecasts.reduce(function (min, forecast) {
|
|
@@ -4949,20 +4957,6 @@
|
|
|
4949
4957
|
enumerable: false,
|
|
4950
4958
|
configurable: true
|
|
4951
4959
|
});
|
|
4952
|
-
Object.defineProperty(PropertyCollection.prototype, "forecastedRentalReturn", {
|
|
4953
|
-
get: function () {
|
|
4954
|
-
return this.sumBy('forecastedRentalReturn');
|
|
4955
|
-
},
|
|
4956
|
-
enumerable: false,
|
|
4957
|
-
configurable: true
|
|
4958
|
-
});
|
|
4959
|
-
Object.defineProperty(PropertyCollection.prototype, "forecastedTaxPosition", {
|
|
4960
|
-
get: function () {
|
|
4961
|
-
return this.sumBy('forecastedTaxPosition');
|
|
4962
|
-
},
|
|
4963
|
-
enumerable: false,
|
|
4964
|
-
configurable: true
|
|
4965
|
-
});
|
|
4966
4960
|
Object.defineProperty(PropertyCollection.prototype, "firstForecastYear", {
|
|
4967
4961
|
get: function () {
|
|
4968
4962
|
return this.items.reduce(function (min, property) {
|
|
@@ -4975,7 +4969,7 @@
|
|
|
4975
4969
|
});
|
|
4976
4970
|
Object.defineProperty(PropertyCollection.prototype, "marketValueGrowth", {
|
|
4977
4971
|
get: function () {
|
|
4978
|
-
return this.
|
|
4972
|
+
return (this.marketValue - this.purchasePrice) / this.purchasePrice;
|
|
4979
4973
|
},
|
|
4980
4974
|
enumerable: false,
|
|
4981
4975
|
configurable: true
|
|
@@ -6037,6 +6031,9 @@
|
|
|
6037
6031
|
enumerable: false,
|
|
6038
6032
|
configurable: true
|
|
6039
6033
|
});
|
|
6034
|
+
Transaction.prototype.isFindAndMatch = function () {
|
|
6035
|
+
return this.operation === exports.TransactionOperationEnum.FIND_AND_MATCH;
|
|
6036
|
+
};
|
|
6040
6037
|
Object.defineProperty(Transaction.prototype, "debit", {
|
|
6041
6038
|
get: function () {
|
|
6042
6039
|
return this.isDebit() ? Math.abs(this.amount) : 0;
|
|
@@ -11005,7 +11002,8 @@
|
|
|
11005
11002
|
transactions.forEach(function (transaction, index) {
|
|
11006
11003
|
// @TODO backend: need to upload file in the same backend endpoint with transaction add/update
|
|
11007
11004
|
// check if passed receipt and upload file
|
|
11008
|
-
|
|
11005
|
+
// @TODO Alex: refactor. Move receipt to separated service and use event dispatcher to handle it
|
|
11006
|
+
if (transaction.file && (transaction.file instanceof File)) {
|
|
11009
11007
|
transaction.id = response[index].id;
|
|
11010
11008
|
addedTransactions[index].file = transaction.file;
|
|
11011
11009
|
_this.uploadReceipt(addedTransactions[index]);
|
|
@@ -11043,7 +11041,8 @@
|
|
|
11043
11041
|
var updatedTransaction = classTransformer.plainToClass(Transaction, response);
|
|
11044
11042
|
// @TODO need to upload file in the same backend endpoint with transaction add/update
|
|
11045
11043
|
// check if passed new receipt and upload file
|
|
11046
|
-
|
|
11044
|
+
// @TODO Alex: refactor. Move receipt to separated service and use event dispatcher to handle it
|
|
11045
|
+
if (transaction.file && (transaction.file instanceof File)) {
|
|
11047
11046
|
updatedTransaction.file = transaction.file;
|
|
11048
11047
|
_this.uploadReceipt(updatedTransaction);
|
|
11049
11048
|
}
|
|
@@ -13587,12 +13586,12 @@
|
|
|
13587
13586
|
}));
|
|
13588
13587
|
};
|
|
13589
13588
|
PropertyCalculationService.prototype.taxPositionGrowth = function (properties, transactions, depreciations) {
|
|
13590
|
-
var
|
|
13591
|
-
// check if
|
|
13592
|
-
if (!
|
|
13589
|
+
var forecastedTaxPosition = properties.sumBy('forecastedTaxPosition');
|
|
13590
|
+
// check if forecastedTaxPosition = 0 to avoid division by zero
|
|
13591
|
+
if (!forecastedTaxPosition) {
|
|
13593
13592
|
return 0;
|
|
13594
13593
|
}
|
|
13595
|
-
return (
|
|
13594
|
+
return (this.getTaxPosition(transactions, depreciations) - forecastedTaxPosition) / forecastedTaxPosition;
|
|
13596
13595
|
};
|
|
13597
13596
|
PropertyCalculationService.prototype.taxPositionGrowth$ = function (properties$, transactions$, depreciations$) {
|
|
13598
13597
|
var _this = this;
|
|
@@ -13659,11 +13658,12 @@
|
|
|
13659
13658
|
};
|
|
13660
13659
|
PropertyCalculationService.prototype.getLvrGrowth = function (properties, bankAccounts, loans) {
|
|
13661
13660
|
var lvr = this.getLvr(properties, bankAccounts);
|
|
13662
|
-
|
|
13663
|
-
|
|
13661
|
+
var lvrCommencement = this.getLvrCommencement(properties, loans, bankAccounts);
|
|
13662
|
+
if (!lvrCommencement) {
|
|
13663
|
+
// check if lvrCommencement = 0 to avoid division by zero
|
|
13664
13664
|
return 0;
|
|
13665
13665
|
}
|
|
13666
|
-
return (
|
|
13666
|
+
return (this.getLvr(properties, bankAccounts) - lvrCommencement) / lvrCommencement;
|
|
13667
13667
|
};
|
|
13668
13668
|
PropertyCalculationService.prototype.getLvrGrowth$ = function (properties$, bankAccounts$, loans$) {
|
|
13669
13669
|
var _this = this;
|
|
@@ -13676,14 +13676,28 @@
|
|
|
13676
13676
|
return _this.getLvrGrowth(properties, bankAccounts, loans);
|
|
13677
13677
|
}));
|
|
13678
13678
|
};
|
|
13679
|
+
/**
|
|
13680
|
+
* Equity position = Market value - current loan value
|
|
13681
|
+
*/
|
|
13679
13682
|
PropertyCalculationService.prototype.getEquityPosition = function (properties, bankAccounts) {
|
|
13680
13683
|
// Math abs is required for correct percentage calculation
|
|
13681
13684
|
return properties.marketValue - Math.abs(this.getLoanValue(properties, bankAccounts));
|
|
13682
13685
|
};
|
|
13686
|
+
/**
|
|
13687
|
+
* Purchase Equity = Purchase price - initial loan value
|
|
13688
|
+
*/
|
|
13683
13689
|
PropertyCalculationService.prototype.getPurchaseEquity = function (properties, bankAccounts, loans) {
|
|
13684
13690
|
// Math abs is required for correct percentage calculation
|
|
13685
13691
|
return properties.purchasePrice - Math.abs(this.getLoanAmount(properties, bankAccounts, loans));
|
|
13686
13692
|
};
|
|
13693
|
+
PropertyCalculationService.prototype.getEquityGrowth = function (properties, bankAccounts, loans) {
|
|
13694
|
+
var purchaseEquity = this.getPurchaseEquity(properties, bankAccounts, loans);
|
|
13695
|
+
// check if purchaseEquity = 0 to avoid division by zero
|
|
13696
|
+
if (!purchaseEquity) {
|
|
13697
|
+
return 0;
|
|
13698
|
+
}
|
|
13699
|
+
return (this.getEquityPosition(properties, bankAccounts) - purchaseEquity) / purchaseEquity;
|
|
13700
|
+
};
|
|
13687
13701
|
/**
|
|
13688
13702
|
* Get dictionary of badges for each property in collection
|
|
13689
13703
|
*/
|
|
@@ -13695,6 +13709,14 @@
|
|
|
13695
13709
|
});
|
|
13696
13710
|
return badgesByProperty;
|
|
13697
13711
|
};
|
|
13712
|
+
PropertyCalculationService.prototype.getCashPositionGrowth = function (properties, transactions) {
|
|
13713
|
+
var forecastedCashPosition = properties.sumBy('forecastedCashPosition');
|
|
13714
|
+
// check if forecastedCashPosition = 0 to avoid division by zero
|
|
13715
|
+
if (!forecastedCashPosition) {
|
|
13716
|
+
return 0;
|
|
13717
|
+
}
|
|
13718
|
+
return (transactions.cashPosition - forecastedCashPosition) / forecastedCashPosition;
|
|
13719
|
+
};
|
|
13698
13720
|
/**
|
|
13699
13721
|
* Get Badge for single property in collection
|
|
13700
13722
|
*/
|
|
@@ -14949,6 +14971,34 @@
|
|
|
14949
14971
|
}] }];
|
|
14950
14972
|
} });
|
|
14951
14973
|
|
|
14974
|
+
// @TODO Artem: implement cache and extend rest?
|
|
14975
|
+
var TutorialVideoService = /** @class */ (function () {
|
|
14976
|
+
function TutorialVideoService(http, environment) {
|
|
14977
|
+
this.http = http;
|
|
14978
|
+
this.environment = environment;
|
|
14979
|
+
}
|
|
14980
|
+
TutorialVideoService.prototype.get = function () {
|
|
14981
|
+
return this.http.get(TutorialVideoService.googleUrl + "&q='" + TutorialVideoService.parents + "'+in+parents&key=" + this.environment.googleDriveId)
|
|
14982
|
+
.pipe(operators.map(function (response) { return response.files; }));
|
|
14983
|
+
};
|
|
14984
|
+
return TutorialVideoService;
|
|
14985
|
+
}());
|
|
14986
|
+
TutorialVideoService.googleUrl = "https://www.googleapis.com/drive/v3/files?fields=*&mimeType='video/mp4'&orderBy=name";
|
|
14987
|
+
TutorialVideoService.parents = '1uLMLzi8WUy2go9xhfzJEwgFwOM43dukM';
|
|
14988
|
+
TutorialVideoService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TutorialVideoService, deps: [{ token: i1__namespace.HttpClient }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
14989
|
+
TutorialVideoService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TutorialVideoService, providedIn: 'root' });
|
|
14990
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TutorialVideoService, decorators: [{
|
|
14991
|
+
type: i0.Injectable,
|
|
14992
|
+
args: [{
|
|
14993
|
+
providedIn: 'root'
|
|
14994
|
+
}]
|
|
14995
|
+
}], ctorParameters: function () {
|
|
14996
|
+
return [{ type: i1__namespace.HttpClient }, { type: undefined, decorators: [{
|
|
14997
|
+
type: i0.Inject,
|
|
14998
|
+
args: ['environment']
|
|
14999
|
+
}] }];
|
|
15000
|
+
} });
|
|
15001
|
+
|
|
14952
15002
|
// deep clone for entity
|
|
14953
15003
|
function cloneDeep(array) {
|
|
14954
15004
|
return JSON.parse(JSON.stringify(array));
|
|
@@ -15122,8 +15172,8 @@
|
|
|
15122
15172
|
var BankAccountPropertiesForm = /** @class */ (function (_super) {
|
|
15123
15173
|
__extends(BankAccountPropertiesForm, _super);
|
|
15124
15174
|
function BankAccountPropertiesForm(bankAccountProperties) {
|
|
15125
|
-
|
|
15126
|
-
|
|
15175
|
+
return _super.call(this, ((bankAccountProperties === null || bankAccountProperties === void 0 ? void 0 : bankAccountProperties.length) ? bankAccountProperties : [classTransformer.plainToClass(BankAccountProperty, {})])
|
|
15176
|
+
.map(function (bankAccountProperty) {
|
|
15127
15177
|
return new forms.FormGroup({
|
|
15128
15178
|
property: new forms.FormControl(bankAccountProperty === null || bankAccountProperty === void 0 ? void 0 : bankAccountProperty.property, forms.Validators.required),
|
|
15129
15179
|
percent: new forms.FormControl(bankAccountProperty.percent, forms.Validators.required)
|
|
@@ -16322,6 +16372,7 @@
|
|
|
16322
16372
|
exports.TransactionReceipt = TransactionReceipt;
|
|
16323
16373
|
exports.TransactionService = TransactionService;
|
|
16324
16374
|
exports.TtCoreModule = TtCoreModule;
|
|
16375
|
+
exports.TutorialVideoService = TutorialVideoService;
|
|
16325
16376
|
exports.USER_ROLES = USER_ROLES;
|
|
16326
16377
|
exports.USER_WORK_POSITION = USER_WORK_POSITION;
|
|
16327
16378
|
exports.User = User;
|