taxtank-core 0.7.3 → 0.8.0
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 +138 -147
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/property/property.collection.js +2 -5
- package/esm2015/lib/db/Enums/property/property-share-access.enum.js +6 -0
- package/esm2015/lib/db/Enums/property/property-share-status.enum.js +7 -0
- package/esm2015/lib/db/Enums/user-event-type-client-type.enum.js +9 -9
- package/esm2015/lib/db/Models/property/property-sale/property-sale.js +1 -1
- package/esm2015/lib/db/Models/property/property-share.js +3 -0
- package/esm2015/lib/db/Models/property/property.js +1 -1
- package/esm2015/lib/db/Models/user.js +1 -1
- package/esm2015/lib/models/endpoint/endpoints.const.js +4 -4
- package/esm2015/lib/models/event/app-event-type.enum.js +2 -2
- package/esm2015/lib/models/notification/notification.js +3 -3
- package/esm2015/lib/models/property/property-sale/property-sale.js +1 -1
- package/esm2015/lib/models/property/{property-owner.js → property-share.js} +15 -15
- package/esm2015/lib/models/property/property.js +9 -8
- package/esm2015/lib/models/property/share-filter-options.enum.js +11 -0
- package/esm2015/lib/services/bank/bank-account.service.js +2 -2
- package/esm2015/lib/services/depreciation/depreciation.service.js +2 -2
- package/esm2015/lib/services/property/property-share/property-share.service.js +115 -0
- package/esm2015/lib/services/property/property.service.js +6 -6
- package/esm2015/public-api.js +7 -6
- package/fesm2015/taxtank-core.js +109 -118
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/property/property.collection.d.ts +1 -4
- package/lib/db/Enums/property/property-share-access.enum.d.ts +4 -0
- package/lib/db/Enums/property/{property-owner-status.enum.d.ts → property-share-status.enum.d.ts} +1 -1
- package/lib/db/Enums/user-event-type-client-type.enum.d.ts +8 -8
- package/lib/db/Models/property/property-sale/property-sale.d.ts +4 -3
- package/lib/db/Models/property/{property-owner.d.ts → property-share.d.ts} +6 -6
- package/lib/db/Models/property/property.d.ts +2 -2
- package/lib/db/Models/user.d.ts +2 -2
- package/lib/models/event/app-event-type.enum.d.ts +1 -1
- package/lib/models/property/{property-owner.d.ts → property-share.d.ts} +3 -3
- package/lib/models/property/property.d.ts +6 -5
- package/lib/models/property/share-filter-options.enum.d.ts +9 -0
- package/lib/services/property/property-share/property-share.service.d.ts +44 -0
- package/lib/services/property/property.service.d.ts +3 -3
- package/package.json +1 -1
- package/public-api.d.ts +6 -5
- package/esm2015/lib/db/Enums/property/property-owner-access.enum.js +0 -6
- package/esm2015/lib/db/Enums/property/property-owner-status.enum.js +0 -7
- package/esm2015/lib/db/Models/property/property-owner.js +0 -3
- package/esm2015/lib/models/property/ownership-filter-options.enum.js +0 -10
- package/esm2015/lib/services/property/property-owner/property-owner.service.js +0 -123
- package/lib/db/Enums/property/property-owner-access.enum.d.ts +0 -4
- package/lib/models/property/ownership-filter-options.enum.d.ts +0 -8
- package/lib/services/property/property-owner/property-owner.service.d.ts +0 -52
|
@@ -895,9 +895,9 @@
|
|
|
895
895
|
PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
|
|
896
896
|
PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
|
|
897
897
|
PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
898
|
+
PROPERTIES_SHARES_PUT: new Endpoint('PUT', '\\/properties\\/shares\\/\\d+'),
|
|
899
|
+
PROPERTIES_SHARES_GET: new Endpoint('GET', '\\/properties\\/shares'),
|
|
900
|
+
PROPERTIES_SHARES_POST: new Endpoint('POST', '\\/properties\\/shares'),
|
|
901
901
|
PROPERTIES_DEACTIVATE_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/deactivate'),
|
|
902
902
|
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
903
903
|
PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
|
|
@@ -2354,10 +2354,7 @@
|
|
|
2354
2354
|
PropertyCollection.prototype.getActiveProperties = function () {
|
|
2355
2355
|
return new PropertyCollection(this.items.filter(function (property) { return property.isActive; }));
|
|
2356
2356
|
};
|
|
2357
|
-
|
|
2358
|
-
* Get new property collection filtered by owner
|
|
2359
|
-
*/
|
|
2360
|
-
PropertyCollection.prototype.getOwnProperties = function () {
|
|
2357
|
+
PropertyCollection.prototype.getCreatedProperties = function () {
|
|
2361
2358
|
return new PropertyCollection(this.items.filter(function (property) { return property.isOwn(); }));
|
|
2362
2359
|
};
|
|
2363
2360
|
/**
|
|
@@ -3291,18 +3288,18 @@
|
|
|
3291
3288
|
PropertyDepreciationCalculationEnum[PropertyDepreciationCalculationEnum["DIMINISHING"] = 2] = "DIMINISHING";
|
|
3292
3289
|
})(exports.PropertyDepreciationCalculationEnum || (exports.PropertyDepreciationCalculationEnum = {}));
|
|
3293
3290
|
|
|
3294
|
-
exports.
|
|
3295
|
-
(function (
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
})(exports.
|
|
3291
|
+
exports.PropertyShareAccessEnum = void 0;
|
|
3292
|
+
(function (PropertyShareAccessEnum) {
|
|
3293
|
+
PropertyShareAccessEnum[PropertyShareAccessEnum["VIEW"] = 1] = "VIEW";
|
|
3294
|
+
PropertyShareAccessEnum[PropertyShareAccessEnum["EDIT"] = 2] = "EDIT";
|
|
3295
|
+
})(exports.PropertyShareAccessEnum || (exports.PropertyShareAccessEnum = {}));
|
|
3299
3296
|
|
|
3300
|
-
exports.
|
|
3301
|
-
(function (
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
})(exports.
|
|
3297
|
+
exports.PropertyShareStatusEnum = void 0;
|
|
3298
|
+
(function (PropertyShareStatusEnum) {
|
|
3299
|
+
PropertyShareStatusEnum[PropertyShareStatusEnum["PENDING"] = 1] = "PENDING";
|
|
3300
|
+
PropertyShareStatusEnum[PropertyShareStatusEnum["APPROVED"] = 2] = "APPROVED";
|
|
3301
|
+
PropertyShareStatusEnum[PropertyShareStatusEnum["REJECTED"] = 3] = "REJECTED";
|
|
3302
|
+
})(exports.PropertyShareStatusEnum || (exports.PropertyShareStatusEnum = {}));
|
|
3306
3303
|
|
|
3307
3304
|
exports.RegistrationInviteStatusEnum = void 0;
|
|
3308
3305
|
(function (RegistrationInviteStatusEnum) {
|
|
@@ -3525,14 +3522,14 @@
|
|
|
3525
3522
|
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_ACCEPTED"] = 2012] = "FIRM_INVITE_ACCEPTED";
|
|
3526
3523
|
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REJECTED"] = 2013] = "FIRM_INVITE_REJECTED";
|
|
3527
3524
|
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["FIRM_INVITE_REGISTERED"] = 2014] = "FIRM_INVITE_REGISTERED";
|
|
3528
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3529
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3530
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3531
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3532
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3533
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3534
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3535
|
-
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["
|
|
3525
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE"] = 2020] = "PROPERTY_SHARE_INVITE";
|
|
3526
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_TO_REGISTER"] = 2021] = "PROPERTY_SHARE_INVITE_TO_REGISTER";
|
|
3527
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_ACCEPTED"] = 2022] = "PROPERTY_SHARE_INVITE_ACCEPTED";
|
|
3528
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_REJECTED"] = 2023] = "PROPERTY_SHARE_INVITE_REJECTED";
|
|
3529
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_INVITE_REGISTERED"] = 2024] = "PROPERTY_SHARE_INVITE_REGISTERED";
|
|
3530
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_REQUESTED"] = 2025] = "PROPERTY_SHARE_CHANGE_REQUESTED";
|
|
3531
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_ACCEPTED"] = 2026] = "PROPERTY_SHARE_CHANGE_ACCEPTED";
|
|
3532
|
+
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["PROPERTY_SHARE_CHANGE_REJECTED"] = 2027] = "PROPERTY_SHARE_CHANGE_REJECTED";
|
|
3536
3533
|
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_NEW_ACCOUNTS"] = 2030] = "BASIQ_NEW_ACCOUNTS";
|
|
3537
3534
|
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_FIRST_IMPORT_COMPLETE"] = 2031] = "BASIQ_FIRST_IMPORT_COMPLETE";
|
|
3538
3535
|
UserEventTypeClientTypeEnum[UserEventTypeClientTypeEnum["BASIQ_AUTHORIZATION_FAIL"] = 2032] = "BASIQ_AUTHORIZATION_FAIL";
|
|
@@ -3607,6 +3604,18 @@
|
|
|
3607
3604
|
VehicleLogbookPurposeEnum[VehicleLogbookPurposeEnum["PERSONAL"] = 2] = "PERSONAL";
|
|
3608
3605
|
})(exports.VehicleLogbookPurposeEnum || (exports.VehicleLogbookPurposeEnum = {}));
|
|
3609
3606
|
|
|
3607
|
+
exports.TaxExemptionEnum = void 0;
|
|
3608
|
+
(function (TaxExemptionEnum) {
|
|
3609
|
+
TaxExemptionEnum[TaxExemptionEnum["ONE_YEAR_RULE"] = 1] = "ONE_YEAR_RULE";
|
|
3610
|
+
// principle place of residence
|
|
3611
|
+
TaxExemptionEnum[TaxExemptionEnum["PPR"] = 2] = "PPR";
|
|
3612
|
+
TaxExemptionEnum[TaxExemptionEnum["SIX_YEARS_RULE"] = 3] = "SIX_YEARS_RULE";
|
|
3613
|
+
TaxExemptionEnum[TaxExemptionEnum["INVESTMENT_TO_PPR"] = 4] = "INVESTMENT_TO_PPR";
|
|
3614
|
+
TaxExemptionEnum[TaxExemptionEnum["PPR_TO_INVESTMENT"] = 5] = "PPR_TO_INVESTMENT";
|
|
3615
|
+
TaxExemptionEnum[TaxExemptionEnum["TRANSFER"] = 6] = "TRANSFER";
|
|
3616
|
+
TaxExemptionEnum[TaxExemptionEnum["OTHER"] = 7] = "OTHER";
|
|
3617
|
+
})(exports.TaxExemptionEnum || (exports.TaxExemptionEnum = {}));
|
|
3618
|
+
|
|
3610
3619
|
exports.TaxExemptionMetadataEnum = void 0;
|
|
3611
3620
|
(function (TaxExemptionMetadataEnum) {
|
|
3612
3621
|
// principle place of residence
|
|
@@ -4536,18 +4545,6 @@
|
|
|
4536
4545
|
classTransformer.Type(function () { return Date; })
|
|
4537
4546
|
], PropertyCategoryMovement.prototype, "toDate", void 0);
|
|
4538
4547
|
|
|
4539
|
-
var TaxExemptionEnum;
|
|
4540
|
-
(function (TaxExemptionEnum) {
|
|
4541
|
-
TaxExemptionEnum[TaxExemptionEnum["ONE_YEAR_RULE"] = 1] = "ONE_YEAR_RULE";
|
|
4542
|
-
// principle place of residence
|
|
4543
|
-
TaxExemptionEnum[TaxExemptionEnum["PPR"] = 2] = "PPR";
|
|
4544
|
-
TaxExemptionEnum[TaxExemptionEnum["SIX_YEARS_RULE"] = 3] = "SIX_YEARS_RULE";
|
|
4545
|
-
TaxExemptionEnum[TaxExemptionEnum["INVESTMENT_TO_PPR"] = 4] = "INVESTMENT_TO_PPR";
|
|
4546
|
-
TaxExemptionEnum[TaxExemptionEnum["PPR_TO_INVESTMENT"] = 5] = "PPR_TO_INVESTMENT";
|
|
4547
|
-
TaxExemptionEnum[TaxExemptionEnum["TRANSFER"] = 6] = "TRANSFER";
|
|
4548
|
-
TaxExemptionEnum[TaxExemptionEnum["OTHER"] = 7] = "OTHER";
|
|
4549
|
-
})(TaxExemptionEnum || (TaxExemptionEnum = {}));
|
|
4550
|
-
|
|
4551
4548
|
var PropertyCategoryListEnum;
|
|
4552
4549
|
(function (PropertyCategoryListEnum) {
|
|
4553
4550
|
PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
|
|
@@ -4677,17 +4674,17 @@
|
|
|
4677
4674
|
});
|
|
4678
4675
|
Object.defineProperty(Property.prototype, "myShare", {
|
|
4679
4676
|
get: function () {
|
|
4680
|
-
return this.
|
|
4677
|
+
return this.shares.find(function (share) { return share.user.id === +localStorage.getItem('userId'); });
|
|
4681
4678
|
},
|
|
4682
4679
|
enumerable: false,
|
|
4683
4680
|
configurable: true
|
|
4684
4681
|
});
|
|
4685
|
-
Object.defineProperty(Property.prototype, "
|
|
4682
|
+
Object.defineProperty(Property.prototype, "shareClaimPercent", {
|
|
4686
4683
|
/**
|
|
4687
|
-
* exact claim
|
|
4684
|
+
* exact claim including share percent
|
|
4688
4685
|
*/
|
|
4689
4686
|
get: function () {
|
|
4690
|
-
return this.
|
|
4687
|
+
return this.sharePercent * this.claimPercent / 100;
|
|
4691
4688
|
},
|
|
4692
4689
|
enumerable: false,
|
|
4693
4690
|
configurable: true
|
|
@@ -4701,9 +4698,9 @@
|
|
|
4701
4698
|
enumerable: false,
|
|
4702
4699
|
configurable: true
|
|
4703
4700
|
});
|
|
4704
|
-
Object.defineProperty(Property.prototype, "
|
|
4701
|
+
Object.defineProperty(Property.prototype, "sharePercent", {
|
|
4705
4702
|
get: function () {
|
|
4706
|
-
return this.myShare.
|
|
4703
|
+
return this.myShare.percent;
|
|
4707
4704
|
},
|
|
4708
4705
|
enumerable: false,
|
|
4709
4706
|
configurable: true
|
|
@@ -4729,12 +4726,13 @@
|
|
|
4729
4726
|
};
|
|
4730
4727
|
Object.defineProperty(Property.prototype, "isShared", {
|
|
4731
4728
|
get: function () {
|
|
4732
|
-
return this.
|
|
4729
|
+
return this.shares.length > 1;
|
|
4733
4730
|
},
|
|
4734
4731
|
enumerable: false,
|
|
4735
4732
|
configurable: true
|
|
4736
4733
|
});
|
|
4737
4734
|
/**
|
|
4735
|
+
* @TODO consider to move methods related with propertySale to separated class, since used just in one module yet
|
|
4738
4736
|
* purchase costs - claimed costs, except `ppr to investment` exemption,
|
|
4739
4737
|
* in that case it's equal to market value, when property became an investment property
|
|
4740
4738
|
*/
|
|
@@ -4767,10 +4765,10 @@
|
|
|
4767
4765
|
switch (true) {
|
|
4768
4766
|
// exemption for main residence properties
|
|
4769
4767
|
case this.category.id === PropertyCategoryListEnum.OWNER_OCCUPIED:
|
|
4770
|
-
return TaxExemptionEnum.PPR;
|
|
4768
|
+
return exports.TaxExemptionEnum.PPR;
|
|
4771
4769
|
// exemption for investment properties owned for at least one year
|
|
4772
4770
|
case this.getOwnershipDuration(sale, 'years') >= 1:
|
|
4773
|
-
return TaxExemptionEnum.ONE_YEAR_RULE;
|
|
4771
|
+
return exports.TaxExemptionEnum.ONE_YEAR_RULE;
|
|
4774
4772
|
default:
|
|
4775
4773
|
return null;
|
|
4776
4774
|
}
|
|
@@ -4783,22 +4781,22 @@
|
|
|
4783
4781
|
var metadata = new PropertySaleTaxExemptionMetadataCollection(sale.taxExemptionMetadata);
|
|
4784
4782
|
switch ((_a = sale.taxExemption) === null || _a === void 0 ? void 0 : _a.id) {
|
|
4785
4783
|
// 50% exemption for investments owned for at least one year
|
|
4786
|
-
case TaxExemptionEnum.ONE_YEAR_RULE:
|
|
4784
|
+
case exports.TaxExemptionEnum.ONE_YEAR_RULE:
|
|
4787
4785
|
return 0.5;
|
|
4788
4786
|
// investment property become main residence (exemption for main residence ownership duration)
|
|
4789
|
-
case TaxExemptionEnum.INVESTMENT_TO_PPR:
|
|
4787
|
+
case exports.TaxExemptionEnum.INVESTMENT_TO_PPR:
|
|
4790
4788
|
var ownershipDays = this.getOwnershipDuration(sale);
|
|
4791
4789
|
return (ownershipDays - metadata.getPPRDays()) / ownershipDays;
|
|
4792
4790
|
// main residence become investment (exemption for home office percent usage)
|
|
4793
|
-
case TaxExemptionEnum.PPR_TO_INVESTMENT:
|
|
4791
|
+
case exports.TaxExemptionEnum.PPR_TO_INVESTMENT:
|
|
4794
4792
|
// 1 year CGT discount can still apply (on the income producing % if used for 12 months or more)
|
|
4795
4793
|
var ratio = this.getOwnershipDuration(sale, 'years') >= 1 ? 0.5 : 1;
|
|
4796
4794
|
return metadata.getClaimPercent() / 100 * ratio;
|
|
4797
4795
|
// full exemption
|
|
4798
|
-
case TaxExemptionEnum.PPR:
|
|
4799
|
-
case TaxExemptionEnum.SIX_YEARS_RULE:
|
|
4800
|
-
case TaxExemptionEnum.TRANSFER:
|
|
4801
|
-
case TaxExemptionEnum.OTHER:
|
|
4796
|
+
case exports.TaxExemptionEnum.PPR:
|
|
4797
|
+
case exports.TaxExemptionEnum.SIX_YEARS_RULE:
|
|
4798
|
+
case exports.TaxExemptionEnum.TRANSFER:
|
|
4799
|
+
case exports.TaxExemptionEnum.OTHER:
|
|
4802
4800
|
return 0;
|
|
4803
4801
|
// no exemption
|
|
4804
4802
|
default:
|
|
@@ -6935,7 +6933,7 @@
|
|
|
6935
6933
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 22] = "PROPERTY_MOVEMENT_CREATED";
|
|
6936
6934
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 23] = "PROPERTY_MOVEMENT_UPDATED";
|
|
6937
6935
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 24] = "PROPERTY_MOVEMENT_DELETED";
|
|
6938
|
-
AppEventTypeEnum[AppEventTypeEnum["
|
|
6936
|
+
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 25] = "PROPERTY_SHARE_UPDATED";
|
|
6939
6937
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 26] = "PROPERTY_SUBSCRIPTION_ADDED";
|
|
6940
6938
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 27] = "PROPERTY_SUBSCRIPTION_DELETED";
|
|
6941
6939
|
AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 28] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
|
|
@@ -7225,8 +7223,8 @@
|
|
|
7225
7223
|
// return '/client/bank-feeds';
|
|
7226
7224
|
// case NOTIFICATION_EVENT_TYPES.clientInvite.includes(obj.eventType):
|
|
7227
7225
|
// return '/client/users/invitations';
|
|
7228
|
-
// case NOTIFICATION_EVENT_TYPES.
|
|
7229
|
-
// return '/client/users/
|
|
7226
|
+
// case NOTIFICATION_EVENT_TYPES.propertyShare.includes(obj.eventType):
|
|
7227
|
+
// return '/client/users/shares';
|
|
7230
7228
|
// case NOTIFICATION_EVENT_TYPES.employeeInviteFromClient.includes(obj.eventType):
|
|
7231
7229
|
// return '/firm/clients/invites';
|
|
7232
7230
|
default:
|
|
@@ -7316,14 +7314,15 @@
|
|
|
7316
7314
|
];
|
|
7317
7315
|
|
|
7318
7316
|
/**
|
|
7317
|
+
* @TODO used only on dashboard, move from tt-core
|
|
7319
7318
|
* Enum with properties ownership filter options
|
|
7320
7319
|
*/
|
|
7321
|
-
exports.
|
|
7322
|
-
(function (
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
})(exports.
|
|
7320
|
+
exports.ShareFilterOptionsEnum = void 0;
|
|
7321
|
+
(function (ShareFilterOptionsEnum) {
|
|
7322
|
+
ShareFilterOptionsEnum[ShareFilterOptionsEnum["ALL"] = 1] = "ALL";
|
|
7323
|
+
ShareFilterOptionsEnum[ShareFilterOptionsEnum["CREATED"] = 2] = "CREATED";
|
|
7324
|
+
ShareFilterOptionsEnum[ShareFilterOptionsEnum["SHARED"] = 3] = "SHARED";
|
|
7325
|
+
})(exports.ShareFilterOptionsEnum || (exports.ShareFilterOptionsEnum = {}));
|
|
7327
7326
|
|
|
7328
7327
|
/**
|
|
7329
7328
|
* class contains equity information for passed financial year
|
|
@@ -7515,35 +7514,35 @@
|
|
|
7515
7514
|
return PropertyEquityChartData;
|
|
7516
7515
|
}());
|
|
7517
7516
|
|
|
7518
|
-
var
|
|
7519
|
-
function
|
|
7517
|
+
var PropertyShare$1 = /** @class */ (function () {
|
|
7518
|
+
function PropertyShare() {
|
|
7520
7519
|
}
|
|
7521
|
-
return
|
|
7520
|
+
return PropertyShare;
|
|
7522
7521
|
}());
|
|
7523
7522
|
|
|
7524
|
-
var
|
|
7525
|
-
__extends(
|
|
7526
|
-
function
|
|
7523
|
+
var PropertyShare = /** @class */ (function (_super) {
|
|
7524
|
+
__extends(PropertyShare, _super);
|
|
7525
|
+
function PropertyShare() {
|
|
7527
7526
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7528
7527
|
}
|
|
7529
|
-
|
|
7530
|
-
return this.status === exports.
|
|
7528
|
+
PropertyShare.prototype.isAccepted = function () {
|
|
7529
|
+
return this.status === exports.PropertyShareStatusEnum.APPROVED;
|
|
7531
7530
|
};
|
|
7532
|
-
|
|
7533
|
-
return this.status === exports.
|
|
7531
|
+
PropertyShare.prototype.isPending = function () {
|
|
7532
|
+
return this.status === exports.PropertyShareStatusEnum.PENDING;
|
|
7534
7533
|
};
|
|
7535
|
-
|
|
7536
|
-
return this.status === exports.
|
|
7534
|
+
PropertyShare.prototype.isRejected = function () {
|
|
7535
|
+
return this.status === exports.PropertyShareStatusEnum.REJECTED;
|
|
7537
7536
|
};
|
|
7538
|
-
Object.defineProperty(
|
|
7537
|
+
Object.defineProperty(PropertyShare.prototype, "statusName", {
|
|
7539
7538
|
get: function () {
|
|
7540
7539
|
var _a;
|
|
7541
|
-
return (_a = exports.
|
|
7540
|
+
return (_a = exports.PropertyShareStatusEnum[this.status]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
7542
7541
|
},
|
|
7543
7542
|
enumerable: false,
|
|
7544
7543
|
configurable: true
|
|
7545
7544
|
});
|
|
7546
|
-
Object.defineProperty(
|
|
7545
|
+
Object.defineProperty(PropertyShare.prototype, "userName", {
|
|
7547
7546
|
/**
|
|
7548
7547
|
* Return full user name if user is already registered.
|
|
7549
7548
|
* Otherwise - return first name from invitation
|
|
@@ -7554,29 +7553,29 @@
|
|
|
7554
7553
|
enumerable: false,
|
|
7555
7554
|
configurable: true
|
|
7556
7555
|
});
|
|
7557
|
-
return
|
|
7558
|
-
}(
|
|
7556
|
+
return PropertyShare;
|
|
7557
|
+
}(PropertyShare$1));
|
|
7559
7558
|
__decorate([
|
|
7560
7559
|
classTransformer.Type(function () { return Date; })
|
|
7561
|
-
],
|
|
7560
|
+
], PropertyShare.prototype, "fromDate", void 0);
|
|
7562
7561
|
__decorate([
|
|
7563
7562
|
classTransformer.Type(function () { return Date; })
|
|
7564
|
-
],
|
|
7563
|
+
], PropertyShare.prototype, "toDate", void 0);
|
|
7565
7564
|
__decorate([
|
|
7566
7565
|
classTransformer.Type(function () { return User; })
|
|
7567
|
-
],
|
|
7566
|
+
], PropertyShare.prototype, "user", void 0);
|
|
7568
7567
|
__decorate([
|
|
7569
7568
|
classTransformer.Type(function () { return RegistrationInvite; })
|
|
7570
|
-
],
|
|
7569
|
+
], PropertyShare.prototype, "invite", void 0);
|
|
7571
7570
|
__decorate([
|
|
7572
7571
|
classTransformer.Type(function () { return Property; })
|
|
7573
|
-
],
|
|
7572
|
+
], PropertyShare.prototype, "property", void 0);
|
|
7574
7573
|
__decorate([
|
|
7575
7574
|
classTransformer.Transform(function (_b) {
|
|
7576
7575
|
var obj = _b.obj;
|
|
7577
7576
|
return obj.user ? obj.user.email : obj.invite.email;
|
|
7578
7577
|
})
|
|
7579
|
-
],
|
|
7578
|
+
], PropertyShare.prototype, "email", void 0);
|
|
7580
7579
|
|
|
7581
7580
|
var PropertySale$1 = /** @class */ (function () {
|
|
7582
7581
|
function PropertySale() {
|
|
@@ -8546,7 +8545,7 @@
|
|
|
8546
8545
|
BankAccountService.prototype.listenToEventDispatcherChanges = function () {
|
|
8547
8546
|
var _this = this;
|
|
8548
8547
|
this.eventDispatcherService.on([
|
|
8549
|
-
exports.AppEventTypeEnum.
|
|
8548
|
+
exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED,
|
|
8550
8549
|
exports.AppEventTypeEnum.LOAN_PAYOUT_UPDATED,
|
|
8551
8550
|
exports.AppEventTypeEnum.BANK_CONNECTION_ADDED
|
|
8552
8551
|
]).subscribe(function () {
|
|
@@ -9768,7 +9767,7 @@
|
|
|
9768
9767
|
*/
|
|
9769
9768
|
DepreciationService.prototype.listenToUpdatedLoan = function () {
|
|
9770
9769
|
var _this = this;
|
|
9771
|
-
this.eventDispatcherService.on([exports.AppEventTypeEnum.LOAN_UPDATED, exports.AppEventTypeEnum.
|
|
9770
|
+
this.eventDispatcherService.on([exports.AppEventTypeEnum.LOAN_UPDATED, exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED]).subscribe(function () {
|
|
9772
9771
|
_this.fetch().subscribe();
|
|
9773
9772
|
});
|
|
9774
9773
|
};
|
|
@@ -10842,17 +10841,17 @@
|
|
|
10842
10841
|
return _this;
|
|
10843
10842
|
}
|
|
10844
10843
|
PropertyService.prototype.listenEvents = function () {
|
|
10845
|
-
this.
|
|
10844
|
+
this.listenShareInviteAccepted();
|
|
10846
10845
|
this.listenServiceSubscriptionUpdated();
|
|
10847
10846
|
// @TODO Alex: consider to refactor property movements logic similar to client-movements
|
|
10848
10847
|
this.listenMovementsChanged();
|
|
10849
10848
|
};
|
|
10850
10849
|
/**
|
|
10851
|
-
* Update cache when
|
|
10850
|
+
* Update cache when share invitation accepted
|
|
10852
10851
|
*/
|
|
10853
|
-
PropertyService.prototype.
|
|
10852
|
+
PropertyService.prototype.listenShareInviteAccepted = function () {
|
|
10854
10853
|
var _this = this;
|
|
10855
|
-
this.eventDispatcherService.on(exports.AppEventTypeEnum.
|
|
10854
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED).subscribe(function () { return _this.resetCache(); });
|
|
10856
10855
|
};
|
|
10857
10856
|
/**
|
|
10858
10857
|
* Update cache when user's service subscription is updated
|
|
@@ -10925,7 +10924,7 @@
|
|
|
10925
10924
|
_this.updateCache();
|
|
10926
10925
|
}));
|
|
10927
10926
|
};
|
|
10928
|
-
PropertyService.prototype.
|
|
10927
|
+
PropertyService.prototype.getByShareId = function (id) {
|
|
10929
10928
|
return this.get().pipe(operators.map(function (properties) {
|
|
10930
10929
|
return properties.filter(function (property) { return property.user.id === id; });
|
|
10931
10930
|
}));
|
|
@@ -11173,114 +11172,106 @@
|
|
|
11173
11172
|
} });
|
|
11174
11173
|
|
|
11175
11174
|
// @TODO check and improve logic during refactoring
|
|
11176
|
-
var
|
|
11177
|
-
__extends(
|
|
11178
|
-
function
|
|
11175
|
+
var PropertyShareService = /** @class */ (function (_super) {
|
|
11176
|
+
__extends(PropertyShareService, _super);
|
|
11177
|
+
function PropertyShareService(http, eventDispatcherService, environment) {
|
|
11179
11178
|
var _this = _super.call(this, http, eventDispatcherService, environment) || this;
|
|
11180
11179
|
_this.http = http;
|
|
11181
11180
|
_this.eventDispatcherService = eventDispatcherService;
|
|
11182
11181
|
_this.environment = environment;
|
|
11183
|
-
// api url parameter for properties
|
|
11184
|
-
_this.url = 'properties/
|
|
11185
|
-
_this.modelClass =
|
|
11182
|
+
// api url parameter for properties shares
|
|
11183
|
+
_this.url = 'properties/shares';
|
|
11184
|
+
_this.modelClass = PropertyShare;
|
|
11186
11185
|
_this.listenEvents();
|
|
11187
11186
|
return _this;
|
|
11188
11187
|
}
|
|
11189
11188
|
/**
|
|
11190
11189
|
* Listen to Event Dispatcher events
|
|
11191
11190
|
*/
|
|
11192
|
-
|
|
11191
|
+
PropertyShareService.prototype.listenEvents = function () {
|
|
11193
11192
|
this.listenUserUpdated();
|
|
11194
11193
|
};
|
|
11195
11194
|
/**
|
|
11196
11195
|
* Updated loan
|
|
11197
11196
|
*/
|
|
11198
|
-
|
|
11197
|
+
PropertyShareService.prototype.update = function (propertyShare) {
|
|
11199
11198
|
var _this = this;
|
|
11200
|
-
return this.http.put(this.environment.apiV2 + "/" + this.url + "/" +
|
|
11201
|
-
.pipe(operators.map(function (
|
|
11202
|
-
var
|
|
11199
|
+
return this.http.put(this.environment.apiV2 + "/" + this.url + "/" + propertyShare.id, propertyShare)
|
|
11200
|
+
.pipe(operators.map(function (updatedPropertyShareBase) {
|
|
11201
|
+
var updatedPropertyShare = classTransformer.plainToClass(PropertyShare, updatedPropertyShareBase);
|
|
11203
11202
|
// if loan type is NOT vehicle - fire EventDispatcher event
|
|
11204
|
-
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.
|
|
11205
|
-
replace(_this.cache,
|
|
11203
|
+
_this.eventDispatcherService.dispatch(new AppEvent(exports.AppEventTypeEnum.PROPERTY_SHARE_UPDATED, null));
|
|
11204
|
+
replace(_this.cache, updatedPropertyShare);
|
|
11206
11205
|
_this.updateCache();
|
|
11207
|
-
return
|
|
11206
|
+
return updatedPropertyShare;
|
|
11208
11207
|
}));
|
|
11209
11208
|
};
|
|
11210
11209
|
/**
|
|
11211
|
-
* Re-invite property
|
|
11210
|
+
* Re-invite property share
|
|
11212
11211
|
* @param share user to share property
|
|
11213
11212
|
*/
|
|
11214
|
-
|
|
11213
|
+
PropertyShareService.prototype.reinvite = function (share) {
|
|
11215
11214
|
return this.http.post(this.environment.apiV2 + "/" + this.url + "/" + share.id + "/reinvite", {});
|
|
11216
11215
|
};
|
|
11217
|
-
|
|
11218
|
-
* Get incoming property owners list
|
|
11219
|
-
*/
|
|
11220
|
-
PropertyOwnerService.prototype.getIncoming = function () {
|
|
11216
|
+
PropertyShareService.prototype.getIncoming = function () {
|
|
11221
11217
|
return this.get()
|
|
11222
|
-
.pipe(operators.map(function (
|
|
11223
|
-
var
|
|
11224
|
-
|
|
11218
|
+
.pipe(operators.map(function (propertyShares) {
|
|
11219
|
+
var propertySharesIncoming = [];
|
|
11220
|
+
propertyShares.forEach(function (propertyShare) {
|
|
11225
11221
|
var _a;
|
|
11226
|
-
if (((_a =
|
|
11227
|
-
|
|
11222
|
+
if (((_a = propertyShare.user) === null || _a === void 0 ? void 0 : _a.isLoggedIn()) && propertyShare.isPending() && propertyShare.property.user.id !== +localStorage.getItem('userId')) {
|
|
11223
|
+
propertySharesIncoming.push(propertyShare);
|
|
11228
11224
|
}
|
|
11229
11225
|
});
|
|
11230
|
-
return
|
|
11226
|
+
return propertySharesIncoming;
|
|
11231
11227
|
}));
|
|
11232
11228
|
};
|
|
11233
11229
|
/**
|
|
11234
|
-
* Get outcoming property
|
|
11230
|
+
* Get outcoming property shares list
|
|
11235
11231
|
*/
|
|
11236
|
-
|
|
11232
|
+
PropertyShareService.prototype.getOutcoming = function () {
|
|
11237
11233
|
var _this = this;
|
|
11238
|
-
return this.get().pipe(operators.map(function (
|
|
11239
|
-
return _this.filterOutcoming(
|
|
11234
|
+
return this.get().pipe(operators.map(function (propertyShares) {
|
|
11235
|
+
return _this.filterOutcoming(propertyShares);
|
|
11240
11236
|
}));
|
|
11241
11237
|
};
|
|
11242
11238
|
/**
|
|
11243
|
-
* Filter outcoming property
|
|
11244
|
-
* @param propertyOwners which should be filtered
|
|
11239
|
+
* Filter outcoming property shares
|
|
11245
11240
|
*/
|
|
11246
|
-
|
|
11247
|
-
var
|
|
11248
|
-
|
|
11241
|
+
PropertyShareService.prototype.filterOutcoming = function (propertyShares) {
|
|
11242
|
+
var propertySharesOutcoming = [];
|
|
11243
|
+
propertyShares.forEach(function (propertyShare) {
|
|
11249
11244
|
var _a;
|
|
11250
|
-
if (!((_a =
|
|
11251
|
-
|
|
11245
|
+
if (!((_a = propertyShare.user) === null || _a === void 0 ? void 0 : _a.isLoggedIn())) {
|
|
11246
|
+
propertySharesOutcoming.push(propertyShare);
|
|
11252
11247
|
}
|
|
11253
11248
|
});
|
|
11254
|
-
return
|
|
11249
|
+
return propertySharesOutcoming;
|
|
11255
11250
|
};
|
|
11256
|
-
|
|
11257
|
-
* Get list of co-owners filtered by property id
|
|
11258
|
-
* @param propertyId
|
|
11259
|
-
*/
|
|
11260
|
-
PropertyOwnerService.prototype.getByPropertyId = function (propertyId) {
|
|
11251
|
+
PropertyShareService.prototype.getByPropertyId = function (propertyId) {
|
|
11261
11252
|
return this.get()
|
|
11262
|
-
.pipe(operators.map(function (
|
|
11263
|
-
return
|
|
11253
|
+
.pipe(operators.map(function (propertyShares) {
|
|
11254
|
+
return propertyShares.filter(function (propertyShare) { return propertyShare.property.id === propertyId; });
|
|
11264
11255
|
}));
|
|
11265
11256
|
};
|
|
11266
11257
|
/**
|
|
11267
11258
|
* Listen to User updated event
|
|
11268
11259
|
*/
|
|
11269
|
-
|
|
11260
|
+
PropertyShareService.prototype.listenUserUpdated = function () {
|
|
11270
11261
|
var _this = this;
|
|
11271
11262
|
this.eventDispatcherService.on(exports.AppEventTypeEnum.USER_UPDATED)
|
|
11272
11263
|
.subscribe(function () {
|
|
11273
|
-
_this.fetch().subscribe(function (
|
|
11274
|
-
_this.cache =
|
|
11264
|
+
_this.fetch().subscribe(function (propertyShares) {
|
|
11265
|
+
_this.cache = propertyShares;
|
|
11275
11266
|
_this.updateCache();
|
|
11276
11267
|
});
|
|
11277
11268
|
});
|
|
11278
11269
|
};
|
|
11279
|
-
return
|
|
11270
|
+
return PropertyShareService;
|
|
11280
11271
|
}(BaseRestService));
|
|
11281
|
-
|
|
11282
|
-
|
|
11283
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type:
|
|
11272
|
+
PropertyShareService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, deps: [{ token: i1__namespace.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11273
|
+
PropertyShareService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, providedIn: 'root' });
|
|
11274
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyShareService, decorators: [{
|
|
11284
11275
|
type: i0.Injectable,
|
|
11285
11276
|
args: [{
|
|
11286
11277
|
providedIn: 'root'
|
|
@@ -13064,12 +13055,12 @@
|
|
|
13064
13055
|
exports.PropertyEquityChartData = PropertyEquityChartData;
|
|
13065
13056
|
exports.PropertyEquityChartItem = PropertyEquityChartItem;
|
|
13066
13057
|
exports.PropertyForecast = PropertyForecast;
|
|
13067
|
-
exports.PropertyOwner = PropertyOwner;
|
|
13068
|
-
exports.PropertyOwnerService = PropertyOwnerService;
|
|
13069
13058
|
exports.PropertySale = PropertySale;
|
|
13070
13059
|
exports.PropertySaleService = PropertySaleService;
|
|
13071
13060
|
exports.PropertySaleTaxExemptionMetadata = PropertySaleTaxExemptionMetadata;
|
|
13072
13061
|
exports.PropertyService = PropertyService;
|
|
13062
|
+
exports.PropertyShare = PropertyShare;
|
|
13063
|
+
exports.PropertyShareService = PropertyShareService;
|
|
13073
13064
|
exports.PropertySubscription = PropertySubscription;
|
|
13074
13065
|
exports.PropertyValuation = PropertyValuation;
|
|
13075
13066
|
exports.RegisterClientForm = RegisterClientForm;
|