taxtank-core 0.31.40 → 0.31.42

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.
Files changed (63) hide show
  1. package/esm2020/lib/collections/property/property-category-movement.collection.mjs +2 -2
  2. package/esm2020/lib/db/Models/document/document.mjs +1 -1
  3. package/esm2020/lib/interfaces/mp-trackable.interface.mjs +1 -1
  4. package/esm2020/lib/models/budget/budget.mjs +2 -2
  5. package/esm2020/lib/models/client/annual-client-details.mjs +2 -2
  6. package/esm2020/lib/models/client/client-income-types.mjs +2 -2
  7. package/esm2020/lib/models/depreciation/depreciation-capital-project.mjs +7 -1
  8. package/esm2020/lib/models/document/document-folder.mjs +4 -1
  9. package/esm2020/lib/models/document/document.mjs +4 -1
  10. package/esm2020/lib/models/endpoint/endpoints.const.mjs +5 -5
  11. package/esm2020/lib/models/property/property-category-movement.mjs +7 -1
  12. package/esm2020/lib/models/property/property-category.mjs +6 -1
  13. package/esm2020/lib/models/property/property-document.mjs +6 -1
  14. package/esm2020/lib/models/property/property-forecast.mjs +8 -2
  15. package/esm2020/lib/models/property/property-sale/property-sale.mjs +8 -1
  16. package/esm2020/lib/models/property/property-share.mjs +8 -2
  17. package/esm2020/lib/models/property/property-subscription.mjs +2 -2
  18. package/esm2020/lib/models/property/property-valuation.mjs +8 -2
  19. package/esm2020/lib/models/property/property.mjs +9 -1
  20. package/esm2020/lib/models/user/user.mjs +2 -2
  21. package/esm2020/lib/models/user-event/user-event-setting.mjs +2 -2
  22. package/esm2020/lib/services/http/bank/bank-connection/bank-connection.service.mjs +3 -3
  23. package/esm2020/lib/services/http/chat/chat.service.mjs +1 -7
  24. package/esm2020/lib/services/http/depreciation/depreciation-capital-project/depreciation-capital-project.service.mjs +15 -48
  25. package/esm2020/lib/services/http/firm/client-invite/client-invite-messages.enum.mjs +3 -1
  26. package/esm2020/lib/services/http/property/property-category-movement/property-category-movement.service.mjs +3 -3
  27. package/esm2020/lib/services/http/property/property-share/property-share.service.mjs +10 -2
  28. package/esm2020/lib/services/http/property/property-valuation/property-valuation.service.mjs +5 -5
  29. package/esm2020/lib/services/http/property/property.service.mjs +19 -2
  30. package/esm2020/lib/services/http/rest/rest.service.mjs +18 -18
  31. package/esm2020/lib/services/http/user/user.service.mjs +2 -2
  32. package/fesm2015/taxtank-core.mjs +245 -199
  33. package/fesm2015/taxtank-core.mjs.map +1 -1
  34. package/fesm2020/taxtank-core.mjs +250 -202
  35. package/fesm2020/taxtank-core.mjs.map +1 -1
  36. package/lib/collections/property/property-category-movement.collection.d.ts +1 -3
  37. package/lib/db/Models/document/document.d.ts +2 -6
  38. package/lib/interfaces/mp-trackable.interface.d.ts +2 -1
  39. package/lib/models/budget/budget.d.ts +1 -1
  40. package/lib/models/client/annual-client-details.d.ts +1 -1
  41. package/lib/models/client/client-income-types.d.ts +1 -1
  42. package/lib/models/depreciation/depreciation-capital-project.d.ts +7 -2
  43. package/lib/models/document/document-folder.d.ts +5 -1
  44. package/lib/models/document/document.d.ts +4 -2
  45. package/lib/models/property/property-category-movement.d.ts +7 -1
  46. package/lib/models/property/property-category.d.ts +5 -1
  47. package/lib/models/property/property-document.d.ts +6 -2
  48. package/lib/models/property/property-forecast.d.ts +7 -1
  49. package/lib/models/property/property-sale/property-sale.d.ts +7 -1
  50. package/lib/models/property/property-share.d.ts +7 -2
  51. package/lib/models/property/property-subscription.d.ts +1 -1
  52. package/lib/models/property/property-valuation.d.ts +7 -1
  53. package/lib/models/property/property.d.ts +8 -1
  54. package/lib/models/user/user.d.ts +1 -1
  55. package/lib/models/user-event/user-event-setting.d.ts +1 -1
  56. package/lib/services/http/chat/chat.service.d.ts +0 -4
  57. package/lib/services/http/depreciation/depreciation-capital-project/depreciation-capital-project.service.d.ts +10 -13
  58. package/lib/services/http/firm/client-invite/client-invite-messages.enum.d.ts +2 -0
  59. package/lib/services/http/property/property-category-movement/property-category-movement.service.d.ts +2 -2
  60. package/lib/services/http/property/property-share/property-share.service.d.ts +1 -1
  61. package/lib/services/http/property/property-valuation/property-valuation.service.d.ts +3 -3
  62. package/lib/services/http/rest/rest.service.d.ts +6 -6
  63. package/package.json +1 -1
@@ -2304,6 +2304,12 @@ var DepreciationCalculationEnum;
2304
2304
  })(DepreciationCalculationEnum || (DepreciationCalculationEnum = {}));
2305
2305
 
2306
2306
  class DepreciationCapitalProject extends DepreciationCapitalProject$1 {
2307
+ getMpData(property) {
2308
+ return {
2309
+ 'Property': property.name,
2310
+ 'Name': this.projectName
2311
+ };
2312
+ }
2307
2313
  }
2308
2314
  __decorate([
2309
2315
  Type(() => Date)
@@ -3849,6 +3855,65 @@ __decorate([
3849
3855
  Type(() => Date)
3850
3856
  ], AssetSale.prototype, "date", void 0);
3851
3857
 
3858
+ var TaxExemptions = [
3859
+ {
3860
+ id: 1,
3861
+ name: "Apply 50% CGT Discount",
3862
+ description: "50% CGT discount applies when an investment property has been owned for more than 12 months (contract date to contract date). Foreign residents are not eligible",
3863
+ metaFields: []
3864
+ },
3865
+ {
3866
+ id: 2,
3867
+ name: "Full Exemption (Principle place of residence)",
3868
+ description: "Your 'main residence' (home) is generally exempt from capital gains tax (CGT). You're not entitled to the exemption for a vacant block of land. Foreign residents are also excluded in most circumstances",
3869
+ metaFields: []
3870
+ },
3871
+ {
3872
+ id: 3,
3873
+ name: "Full Exemption (6 year rule)",
3874
+ description: "You can nominate an investment property as your main residence for up to 6 years if it is used to produce income, or indefinitely if it is not used to produce income. However, you can not treat any other dwelling as your main residence for the same period",
3875
+ metaFields: []
3876
+ },
3877
+ {
3878
+ id: 4,
3879
+ name: "Partial exemption (investment property became your main residence)",
3880
+ description: "The number of days the dwelling was not your main residence, and the total ownership days are used to calculate the taxable portion of any CGT",
3881
+ metaFields: [
3882
+ {
3883
+ id: 1,
3884
+ name: "Total amount of days the property was your main residence"
3885
+ }
3886
+ ]
3887
+ },
3888
+ {
3889
+ id: 5,
3890
+ name: "Main Residence became your 'investment property' or 'home office'",
3891
+ description: "The market value at the time a principle place of residence became an investment property, or is used as a home business, becomes the adjusted cost base. The percentage of home office use (if applicable) is then applied",
3892
+ metaFields: [
3893
+ {
3894
+ id: 2,
3895
+ name: "Market Value"
3896
+ },
3897
+ {
3898
+ id: 2,
3899
+ name: "Home office percentage claimed"
3900
+ }
3901
+ ]
3902
+ },
3903
+ {
3904
+ id: 6,
3905
+ name: "Property transfer (Relationship Breakdown)",
3906
+ description: "If you transfer an asset to your spouse because of a relationship breakdown a 'rollover' generally applies. This means the transferor spouse disregards any capital gain or loss that would otherwise arise",
3907
+ metaFields: []
3908
+ },
3909
+ {
3910
+ id: 7,
3911
+ name: "Full exemption (Other)",
3912
+ description: "In some other instances a full exemption may apply, for example pre-CGT assets and some inheritance",
3913
+ metaFields: []
3914
+ }
3915
+ ];
3916
+
3852
3917
  class PropertySale extends AssetSale {
3853
3918
  get saleCostsTotalAmount() {
3854
3919
  return this.commission + this.legalFees + this.otherCost;
@@ -3864,6 +3929,12 @@ class PropertySale extends AssetSale {
3864
3929
  get netPrice() {
3865
3930
  return this.price - this.saleCostsTotalAmount;
3866
3931
  }
3932
+ getMpData(property) {
3933
+ return {
3934
+ 'Property': property.name,
3935
+ 'Concession': TaxExemptions.find((taxExemption) => taxExemption.id === this.taxExemption.id).name
3936
+ };
3937
+ }
3867
3938
  }
3868
3939
  __decorate([
3869
3940
  Type(() => Number)
@@ -3899,12 +3970,30 @@ __decorate([
3899
3970
  Type(() => PropertySaleTaxExemptionMetaField$1)
3900
3971
  ], PropertySale.prototype, "taxExemptionMetaFields", void 0);
3901
3972
 
3902
- var UserStatusEnum;
3903
- (function (UserStatusEnum) {
3904
- UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
3905
- UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
3906
- UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
3907
- })(UserStatusEnum || (UserStatusEnum = {}));
3973
+ var MyAccountHistoryInitiatedByEnum;
3974
+ (function (MyAccountHistoryInitiatedByEnum) {
3975
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
3976
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
3977
+ })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
3978
+
3979
+ var MyAccountHistoryStatusEnum;
3980
+ (function (MyAccountHistoryStatusEnum) {
3981
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
3982
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
3983
+ })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
3984
+
3985
+ var MyAccountHistoryTypeEnum;
3986
+ (function (MyAccountHistoryTypeEnum) {
3987
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
3988
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
3989
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
3990
+ })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
3991
+
3992
+ class MyAccountHistory {
3993
+ }
3994
+
3995
+ class Occupation extends Occupation$1 {
3996
+ }
3908
3997
 
3909
3998
  var UserRolesEnum;
3910
3999
  (function (UserRolesEnum) {
@@ -3923,12 +4012,44 @@ var UserRolesEnum;
3923
4012
  UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
3924
4013
  })(UserRolesEnum || (UserRolesEnum = {}));
3925
4014
 
4015
+ /**
4016
+ * role hierarchy
4017
+ */
4018
+ const USER_ROLES = {
4019
+ ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4020
+ ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4021
+ ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4022
+ ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
4023
+ ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
4024
+ // @TODO makes no sense, these roles can't be hierarchical
4025
+ ROLE_CLIENT: [UserRolesEnum.CLIENT],
4026
+ ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
4027
+ ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
4028
+ ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
4029
+ ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
4030
+ ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
4031
+ ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
4032
+ };
4033
+
4034
+ /**
4035
+ * Class with basic information about registering user
4036
+ */
4037
+ class UserToRegister {
4038
+ }
4039
+
3926
4040
  const USER_WORK_POSITION = {
3927
4041
  [UserRolesEnum.EMPLOYEE]: 'Employee',
3928
4042
  [UserRolesEnum.FIRM_MANAGER]: 'Manager',
3929
4043
  [UserRolesEnum.FIRM_OWNER]: 'Firm Owner'
3930
4044
  };
3931
4045
 
4046
+ var UserStatusEnum;
4047
+ (function (UserStatusEnum) {
4048
+ UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
4049
+ UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
4050
+ UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
4051
+ })(UserStatusEnum || (UserStatusEnum = {}));
4052
+
3932
4053
  class ClientDetails extends ClientDetails$1 {
3933
4054
  }
3934
4055
 
@@ -3941,7 +4062,7 @@ class AnnualClientDetails extends AbstractModel {
3941
4062
  get spouseMonthlyIncome() {
3942
4063
  return this.spouseAnnualIncome / 12;
3943
4064
  }
3944
- get mpData() {
4065
+ getMpData() {
3945
4066
  return {
3946
4067
  capitalLoss: this.capitalLoss,
3947
4068
  privateHealthCare: this.privateHealthCare,
@@ -3965,7 +4086,7 @@ class ClientIncomeTypes extends ClientIncomeTypes$1 {
3965
4086
  get length() {
3966
4087
  return Object.values(this).filter((value) => typeof value === 'boolean' && value).length;
3967
4088
  }
3968
- get mpData() {
4089
+ getMpData() {
3969
4090
  return { work: this.work, property: this.property, sole: this.sole, holding: this.holdings };
3970
4091
  }
3971
4092
  }
@@ -4008,56 +4129,6 @@ __decorate([
4008
4129
  Type(() => Country)
4009
4130
  ], Phone.prototype, "country", void 0);
4010
4131
 
4011
- var MyAccountHistoryInitiatedByEnum;
4012
- (function (MyAccountHistoryInitiatedByEnum) {
4013
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
4014
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
4015
- })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
4016
-
4017
- var MyAccountHistoryStatusEnum;
4018
- (function (MyAccountHistoryStatusEnum) {
4019
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
4020
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
4021
- })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
4022
-
4023
- var MyAccountHistoryTypeEnum;
4024
- (function (MyAccountHistoryTypeEnum) {
4025
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
4026
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
4027
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
4028
- })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
4029
-
4030
- class MyAccountHistory {
4031
- }
4032
-
4033
- class Occupation extends Occupation$1 {
4034
- }
4035
-
4036
- /**
4037
- * role hierarchy
4038
- */
4039
- const USER_ROLES = {
4040
- ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4041
- ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4042
- ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4043
- ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
4044
- ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
4045
- // @TODO makes no sense, these roles can't be hierarchical
4046
- ROLE_CLIENT: [UserRolesEnum.CLIENT],
4047
- ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
4048
- ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
4049
- ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
4050
- ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
4051
- ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
4052
- ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
4053
- };
4054
-
4055
- /**
4056
- * Class with basic information about registering user
4057
- */
4058
- class UserToRegister {
4059
- }
4060
-
4061
4132
  var FirmTypeEnum;
4062
4133
  (function (FirmTypeEnum) {
4063
4134
  FirmTypeEnum[FirmTypeEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
@@ -5311,7 +5382,7 @@ class User extends User$1 {
5311
5382
  get financialYears() {
5312
5383
  return range(Math.min(FinancialYear.toFinYear(this.createdAt) - 1, 2022), FinancialYear.toFinYear(new Date()) + 1);
5313
5384
  }
5314
- get mpData() {
5385
+ getMpData() {
5315
5386
  return {
5316
5387
  clientDetails: {}
5317
5388
  };
@@ -5372,12 +5443,22 @@ class PropertyCategory extends PropertyCategory$1 {
5372
5443
  isShared() {
5373
5444
  return this.id === PropertyCategoryListEnum.SHARED;
5374
5445
  }
5446
+ getMpData() {
5447
+ return {
5448
+ 'Name': this.name
5449
+ };
5450
+ }
5375
5451
  }
5376
5452
 
5377
5453
  class PropertyDocument extends PropertyDocument$1 {
5378
5454
  get parent() {
5379
5455
  return this.property;
5380
5456
  }
5457
+ getMpData(property) {
5458
+ return {
5459
+ 'Property': property.name
5460
+ };
5461
+ }
5381
5462
  }
5382
5463
  __decorate([
5383
5464
  Type(() => Property)
@@ -5393,6 +5474,12 @@ class PropertyValuation extends PropertyValuation$1 {
5393
5474
  isCurrentYear() {
5394
5475
  return this.financialYear === new FinancialYear(new Date()).year;
5395
5476
  }
5477
+ getMpData(property) {
5478
+ return {
5479
+ 'Property': property.name,
5480
+ 'Date': this.date
5481
+ };
5482
+ }
5396
5483
  }
5397
5484
  __decorate([
5398
5485
  Type(() => Date)
@@ -5436,6 +5523,12 @@ class PropertyForecast extends PropertyForecast$1 {
5436
5523
  isCurrentYear() {
5437
5524
  return this.financialYear === new FinancialYear(new Date()).year;
5438
5525
  }
5526
+ getMpData(property) {
5527
+ return {
5528
+ 'Property': property.name,
5529
+ 'Financial Year': this.financialYear,
5530
+ };
5531
+ }
5439
5532
  }
5440
5533
  __decorate([
5441
5534
  Transform(({ value }) => +value)
@@ -5457,6 +5550,12 @@ __decorate([
5457
5550
  ], PropertyForecast.prototype, "marketValue", void 0);
5458
5551
 
5459
5552
  class PropertyCategoryMovement extends PropertyCategoryMovement$1 {
5553
+ getMpData(property) {
5554
+ return {
5555
+ 'Property': property.name,
5556
+ 'Category': this.propertyCategory.name
5557
+ };
5558
+ }
5460
5559
  }
5461
5560
  __decorate([
5462
5561
  Type(() => PropertyValuation)
@@ -5664,6 +5763,14 @@ class Property extends Property$1 {
5664
5763
  get monthlyExpense() {
5665
5764
  return this.currentYearForecast.expense / 12;
5666
5765
  }
5766
+ getMpData() {
5767
+ return {
5768
+ 'Category': this.category.name,
5769
+ 'Taxable': this.category.isTaxInclusive ? 'Yes' : 'No',
5770
+ 'Shared': this.isShared ? 'Yes' : 'No',
5771
+ 'Ownership %': `${this.myShare.percent}%`
5772
+ };
5773
+ }
5667
5774
  }
5668
5775
  /**
5669
5776
  * Property acquired before 20 September 1985 will generally be treated as pre-Capital Gains Tax (CGT) assets.
@@ -6030,6 +6137,12 @@ class PropertyShare extends PropertyShare$1 {
6030
6137
  get userName() {
6031
6138
  return this.user ? this.user.fullName : `${this.invite.firstName}`;
6032
6139
  }
6140
+ getMpData() {
6141
+ return {
6142
+ 'Property': this.property.name,
6143
+ 'User': this.user.email
6144
+ };
6145
+ }
6033
6146
  }
6034
6147
  __decorate([
6035
6148
  Type(() => Date)
@@ -9934,12 +10047,18 @@ __decorate([
9934
10047
  ], Notification.prototype, "redirectionLink", void 0);
9935
10048
 
9936
10049
  class DocumentFolder extends DocumentFolder$1 {
10050
+ getMpData() {
10051
+ return { 'Name': this.name };
10052
+ }
9937
10053
  }
9938
10054
 
9939
10055
  class Document extends Document$1 {
9940
10056
  get parent() {
9941
10057
  return this.folder;
9942
10058
  }
10059
+ getMpData() {
10060
+ return {};
10061
+ }
9943
10062
  }
9944
10063
  __decorate([
9945
10064
  Type(() => DocumentFolder)
@@ -10171,7 +10290,7 @@ class Budget extends Budget$1 {
10171
10290
  get rulesCollection() {
10172
10291
  return new Collection(this.rules);
10173
10292
  }
10174
- get mpData() {
10293
+ getMpData() {
10175
10294
  return {};
10176
10295
  }
10177
10296
  }
@@ -10564,15 +10683,15 @@ let RestService$1 = class RestService extends DataService {
10564
10683
  /**
10565
10684
  * Create a new Model instance in database
10566
10685
  */
10567
- post(model, path = this.apiUrl) {
10686
+ post(model, mpData, path = this.apiUrl) {
10568
10687
  this.handleAccessError('post');
10569
10688
  return this.http.post(path, classToPlain(model))
10570
10689
  .pipe(map((response) => {
10571
10690
  const result = this.createModelInstance(response);
10572
- this.handleResponse([result], 'post');
10691
+ this.handleResponse([result], 'post', mpData);
10573
10692
  return result;
10574
10693
  }), catchError((error) => {
10575
- this.handleResponseError([model], 'post');
10694
+ this.handleResponseError([model], 'post', mpData);
10576
10695
  return throwError(error);
10577
10696
  }));
10578
10697
  }
@@ -10594,15 +10713,15 @@ let RestService$1 = class RestService extends DataService {
10594
10713
  /**
10595
10714
  * Change an existing Model instance in database
10596
10715
  */
10597
- put(model, path = `${this.apiUrl}/${model.id}`) {
10716
+ put(model, mpData, path = `${this.apiUrl}/${model.id}`) {
10598
10717
  this.handleAccessError('put');
10599
10718
  return this.http.put(path, classToPlain(model))
10600
10719
  .pipe(map((response) => {
10601
10720
  const result = this.createModelInstance(response);
10602
- this.handleResponse([result], 'put');
10721
+ this.handleResponse([result], 'put', mpData);
10603
10722
  return result;
10604
10723
  }), catchError((error) => {
10605
- this.handleResponseError([model], 'put');
10724
+ this.handleResponseError([model], 'put', mpData);
10606
10725
  return throwError(error);
10607
10726
  }));
10608
10727
  }
@@ -10624,13 +10743,13 @@ let RestService$1 = class RestService extends DataService {
10624
10743
  /**
10625
10744
  * Remove a Model instance from database
10626
10745
  */
10627
- delete(model) {
10746
+ delete(model, mpData) {
10628
10747
  this.handleAccessError('delete');
10629
10748
  return this.http.delete(`${this.apiUrl}/${model.id}`)
10630
10749
  .pipe(map(() => {
10631
- this.handleResponse([model], 'delete');
10750
+ this.handleResponse([model], 'delete', mpData);
10632
10751
  }), catchError((error) => {
10633
- this.handleResponseError([model], 'delete');
10752
+ this.handleResponseError([model], 'delete', mpData);
10634
10753
  return throwError(error);
10635
10754
  }));
10636
10755
  }
@@ -10647,23 +10766,23 @@ let RestService$1 = class RestService extends DataService {
10647
10766
  return throwError(error);
10648
10767
  }));
10649
10768
  }
10650
- track(response, method, postfix = '') {
10651
- // not other way to check interface
10652
- if ('mpData' in response[0]) {
10769
+ track(response, method, mpData, postfix = '') {
10770
+ // no other way to check interface
10771
+ if ('getMpData' in response[0]) {
10653
10772
  response.forEach((model) => {
10654
- this.mpService.track(`${method}${this.modelClass.name}${postfix}`, model['mpData']);
10773
+ this.mpService.track(`${method}${this.modelClass.name}${postfix}`, model['getMpData'](mpData));
10655
10774
  });
10656
10775
  }
10657
10776
  }
10658
- handleResponseError(response, method) {
10777
+ handleResponseError(response, method, mpData) {
10659
10778
  // @TODO error notification?
10660
- this.track(response, method, 'Error');
10779
+ this.track(response, method, mpData, 'Error');
10661
10780
  }
10662
10781
  /**
10663
10782
  * Handle response data - update cache and dispatch event if it is needed
10664
10783
  */
10665
- handleResponse(response, method) {
10666
- this.track(response, method);
10784
+ handleResponse(response, method, mpData) {
10785
+ this.track(response, method, mpData);
10667
10786
  if (this.getCache()) {
10668
10787
  this.updateCache(response, method);
10669
10788
  }
@@ -10970,10 +11089,10 @@ class BankConnectionService extends RestService$1 {
10970
11089
  }));
10971
11090
  }
10972
11091
  activate(bankConnection) {
10973
- return this.put(bankConnection, `${this.apiUrl}/${bankConnection.id}/activate`);
11092
+ return this.put(bankConnection, null, `${this.apiUrl}/${bankConnection.id}/activate`);
10974
11093
  }
10975
11094
  deactivate(bankConnection) {
10976
- return this.put(bankConnection, `${this.apiUrl}/${bankConnection.id}/deactivate`);
11095
+ return this.put(bankConnection, null, `${this.apiUrl}/${bankConnection.id}/deactivate`);
10977
11096
  }
10978
11097
  /**
10979
11098
  * connection's status updated in background on backend, so reset cache required to inform user
@@ -11415,12 +11534,6 @@ class ChatService extends RestService$1 {
11415
11534
  this.listenChats();
11416
11535
  this.listenMessages();
11417
11536
  }
11418
- /**
11419
- * We don't need chats with taxtank employees
11420
- */
11421
- setCache(data, next = false) {
11422
- super.setCache(data.filter((data) => data.employee.email !== this.environment.ttAccountant && data.employee.email !== this.environment.ttAdvisor), next);
11423
- }
11424
11537
  /**
11425
11538
  * Listen chats events
11426
11539
  */
@@ -11701,57 +11814,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
11701
11814
 
11702
11815
  /**
11703
11816
  * Service for work with DepreciationCapitalProjects
11817
+ * @TODO Alex: refactor with new rest when backend ready (TT-3571)
11704
11818
  */
11705
- class DepreciationCapitalProjectService {
11706
- constructor(http, environment) {
11707
- this.http = http;
11708
- this.environment = environment;
11709
- this.cacheSubject = new ReplaySubject(1);
11710
- }
11711
- get(propertyId) {
11712
- this.cacheSubject.next([]);
11713
- this.http.get(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects`)
11714
- .subscribe((capitalProjectsBase) => {
11715
- this.cache = capitalProjectsBase.map((capitalProjectBase) => plainToClass(DepreciationCapitalProject, capitalProjectBase));
11716
- this.cacheSubject.next(this.cache);
11717
- });
11718
- return this.cacheSubject.asObservable();
11719
- }
11720
- add(capitalProject, propertyId) {
11721
- return this.http.post(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects`, capitalProject)
11722
- .pipe(map((capitalProjectBase) => {
11723
- this.cache.push(plainToClass(DepreciationCapitalProject, capitalProjectBase));
11724
- this.cacheSubject.next(this.cache);
11725
- }));
11726
- }
11727
- update(capitalProject, propertyId) {
11728
- return this.http.put(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects/${capitalProject.id}`, capitalProject)
11729
- .pipe(map((capitalProjectBase) => {
11730
- replace(this.cache, plainToClass(DepreciationCapitalProject, capitalProjectBase));
11731
- this.cacheSubject.next(this.cache);
11732
- }));
11733
- }
11734
- delete(capitalProject, propertyId) {
11735
- return this.http.delete(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects/${capitalProject.id}`)
11736
- .pipe(map(() => {
11737
- this.cache = this.cache.filter((item) => capitalProject.id !== item.id);
11738
- this.cacheSubject.next(this.cache);
11739
- }));
11819
+ class DepreciationCapitalProjectService extends RestService$1 {
11820
+ constructor() {
11821
+ super(...arguments);
11822
+ this.modelClass = DepreciationCapitalProject;
11823
+ this.collectionClass = Collection;
11824
+ this.endpointUri = 'depreciation-capital-projects';
11825
+ this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
11740
11826
  }
11741
11827
  }
11742
- DepreciationCapitalProjectService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
11828
+ DepreciationCapitalProjectService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
11743
11829
  DepreciationCapitalProjectService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, providedIn: 'root' });
11744
11830
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, decorators: [{
11745
11831
  type: Injectable,
11746
11832
  args: [{
11747
11833
  providedIn: 'root'
11748
11834
  }]
11749
- }], ctorParameters: function () {
11750
- return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
11751
- type: Inject,
11752
- args: ['environment']
11753
- }] }];
11754
- } });
11835
+ }] });
11755
11836
 
11756
11837
  var DocumentFolderMessagesEnum;
11757
11838
  (function (DocumentFolderMessagesEnum) {
@@ -12418,6 +12499,8 @@ var ClientInviteMessages;
12418
12499
  ClientInviteMessages["REVOKE_TT_ADVISOR_CONFIRM"] = "Are you sure you want to revoke access?";
12419
12500
  ClientInviteMessages["TT_ADVISOR_REVOKED"] = "Access revoked";
12420
12501
  ClientInviteMessages["TT_INVITE_ACCEPT"] = "You successfully accepted the invitation";
12502
+ ClientInviteMessages["SEND_INVITE_MESSAGES_TITLE"] = "TaxTank support is here to help";
12503
+ ClientInviteMessages["SEND_INVITE_MESSAGES_DESCRIPTION"] = "Before inviting TaxTank support be sure to check out our help articles and message our support team.";
12421
12504
  ClientInviteMessages["TT_ACCOUNTANT_INVITED"] = "Accountant invitation has been sent successfully";
12422
12505
  ClientInviteMessages["TT_ACCOUNTANT_INVETED_TOOLTIP"] = "Need an accountant? TaxTank Accountants delivers virtual accounting service exclusive to TaxTank subscribers. Experience a fast, seamless, and cost-effective lodgement service that rewards your TaxTank efforts throughout the year. Our team of experienced accountants brings their expertise in tax and TaxTank to the virtual realm. It all starts with a 15-minute consultation that sets the stage for personalised service. With us, you\u2019ll receive the best of both worlds at tax time.";
12423
12506
  })(ClientInviteMessages || (ClientInviteMessages = {}));
@@ -13228,8 +13311,8 @@ class PropertyCategoryMovementService extends RestService$1 {
13228
13311
  this.endpointUri = 'properties/category-movements';
13229
13312
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
13230
13313
  }
13231
- post(movement) {
13232
- return super.post(movement, `${this.environment.apiV2}/properties/${movement.property.id}/category-movements`);
13314
+ post(movement, property) {
13315
+ return super.post(movement, property, `${this.environment.apiV2}/properties/${movement.property.id}/category-movements`);
13233
13316
  }
13234
13317
  }
13235
13318
  PropertyCategoryMovementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: PropertyCategoryMovementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -13294,65 +13377,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
13294
13377
  }]
13295
13378
  }] });
13296
13379
 
13297
- var TaxExemptions = [
13298
- {
13299
- id: 1,
13300
- name: "Apply 50% CGT Discount",
13301
- description: "50% CGT discount applies when an investment property has been owned for more than 12 months (contract date to contract date). Foreign residents are not eligible",
13302
- metaFields: []
13303
- },
13304
- {
13305
- id: 2,
13306
- name: "Full Exemption (Principle place of residence)",
13307
- description: "Your 'main residence' (home) is generally exempt from capital gains tax (CGT). You're not entitled to the exemption for a vacant block of land. Foreign residents are also excluded in most circumstances",
13308
- metaFields: []
13309
- },
13310
- {
13311
- id: 3,
13312
- name: "Full Exemption (6 year rule)",
13313
- description: "You can nominate an investment property as your main residence for up to 6 years if it is used to produce income, or indefinitely if it is not used to produce income. However, you can not treat any other dwelling as your main residence for the same period",
13314
- metaFields: []
13315
- },
13316
- {
13317
- id: 4,
13318
- name: "Partial exemption (investment property became your main residence)",
13319
- description: "The number of days the dwelling was not your main residence, and the total ownership days are used to calculate the taxable portion of any CGT",
13320
- metaFields: [
13321
- {
13322
- id: 1,
13323
- name: "Total amount of days the property was your main residence"
13324
- }
13325
- ]
13326
- },
13327
- {
13328
- id: 5,
13329
- name: "Main Residence became your 'investment property' or 'home office'",
13330
- description: "The market value at the time a principle place of residence became an investment property, or is used as a home business, becomes the adjusted cost base. The percentage of home office use (if applicable) is then applied",
13331
- metaFields: [
13332
- {
13333
- id: 2,
13334
- name: "Market Value"
13335
- },
13336
- {
13337
- id: 2,
13338
- name: "Home office percentage claimed"
13339
- }
13340
- ]
13341
- },
13342
- {
13343
- id: 6,
13344
- name: "Property transfer (Relationship Breakdown)",
13345
- description: "If you transfer an asset to your spouse because of a relationship breakdown a 'rollover' generally applies. This means the transferor spouse disregards any capital gain or loss that would otherwise arise",
13346
- metaFields: []
13347
- },
13348
- {
13349
- id: 7,
13350
- name: "Full exemption (Other)",
13351
- description: "In some other instances a full exemption may apply, for example pre-CGT assets and some inheritance",
13352
- metaFields: []
13353
- }
13354
- ];
13355
-
13356
13380
  class TaxExemptionService extends DataService {
13357
13381
  constructor() {
13358
13382
  super();
@@ -13410,7 +13434,13 @@ class PropertyShareService extends RestService$1 {
13410
13434
  * @param share user to share property
13411
13435
  */
13412
13436
  reinvite(share) {
13413
- return this.http.post(`${this.apiUrl}/${share.id}/reinvite`, {});
13437
+ return this.http.post(`${this.apiUrl}/${share.id}/reinvite`, {})
13438
+ .pipe(map(() => {
13439
+ this.mpService.track('reinvitePropertyShare', share.getMpData());
13440
+ }), catchError((error) => {
13441
+ this.mpService.track('reinvitePropertyShareError', share.getMpData());
13442
+ return throwError(error);
13443
+ }));
13414
13444
  }
13415
13445
  /**
13416
13446
  * Listen to User updated event
@@ -13452,11 +13482,11 @@ class PropertyValuationService extends RestService$1 {
13452
13482
  return this.http.get(`${this.apiUrl}/${propertyId}/valuations`)
13453
13483
  .pipe(map((valuations) => new Collection(valuations.map((valuation) => plainToClass(PropertyValuation, valuation)))));
13454
13484
  }
13455
- post(valuation, propertyId) {
13456
- return super.post(valuation, `${this.apiUrl}/${propertyId}/valuations`);
13485
+ post(valuation, property) {
13486
+ return super.post(valuation, property, `${this.apiUrl}/${property.id}/valuations`);
13457
13487
  }
13458
- put(valuation, propertyId) {
13459
- return super.put(valuation, `${this.apiUrl}/${propertyId}/valuations/${valuation.id}`);
13488
+ put(valuation, property) {
13489
+ return super.put(valuation, property, `${this.apiUrl}/${property.id}/valuations/${valuation.id}`);
13460
13490
  }
13461
13491
  }
13462
13492
  PropertyValuationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: PropertyValuationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -13549,7 +13579,15 @@ class PropertyService extends RestService$1 {
13549
13579
  .pipe(map((propertySubscriptionBase) => {
13550
13580
  const newPropertySubscription = plainToClass(PropertySubscription, propertySubscriptionBase);
13551
13581
  const activatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
13582
+ this.mpService.track(`postPropertySubscription`, {
13583
+ 'Property': property.name,
13584
+ });
13552
13585
  this.updateCache([activatedProperty], 'put');
13586
+ }), catchError((error) => {
13587
+ this.mpService.track('postPropertySubscriptionError', {
13588
+ 'Property': property.name,
13589
+ });
13590
+ return throwError(error);
13553
13591
  }));
13554
13592
  }
13555
13593
  /**
@@ -13559,7 +13597,15 @@ class PropertyService extends RestService$1 {
13559
13597
  return this.http.delete(`${this.environment.apiV2}/property-subscriptions/${property.getCurrentSubscription().id}`)
13560
13598
  .pipe(map(() => {
13561
13599
  const deactivatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
13600
+ this.mpService.track(`deletePropertySubscription`, {
13601
+ 'Property': property.name,
13602
+ });
13562
13603
  this.updateCache([deactivatedProperty], 'put');
13604
+ }), catchError((error) => {
13605
+ this.mpService.track('deletePropertySubscriptionError', {
13606
+ 'Property': property.name,
13607
+ });
13608
+ return throwError(error);
13563
13609
  }));
13564
13610
  }
13565
13611
  /**
@@ -15477,7 +15523,7 @@ class UserEventSetting extends UserEventSetting$1 {
15477
15523
  // flag indicates that the setting is updating now saved or not
15478
15524
  this.isUpdating = false;
15479
15525
  }
15480
- get mpData() {
15526
+ getMpData() {
15481
15527
  return { type: this.type.name, byEmail: this.byEmail, byNotification: this.byNotification, frequency: this.type.frequencyLabel };
15482
15528
  }
15483
15529
  }
@@ -15635,7 +15681,7 @@ class UserService extends RestService$1 {
15635
15681
  return this.http.get(`${this.apiUrl}/search`, { params: { email } }).pipe(map((userBase) => this.createModelInstance(userBase)));
15636
15682
  }
15637
15683
  finishOnboarding(user) {
15638
- return this.put(user, `${this.apiUrl}/status`);
15684
+ return this.put(user, null, `${this.apiUrl}/status`);
15639
15685
  }
15640
15686
  updatePhoto(photo) {
15641
15687
  return this.http.post(`${this.apiUrl}/photo?_method=PUT`, photo).pipe(map((photoUrl) => {
@@ -19674,10 +19720,10 @@ const ENDPOINTS = {
19674
19720
  PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
19675
19721
  PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
19676
19722
  PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
19677
- PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
19678
- PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
19679
- PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
19680
- PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
19723
+ PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/property-documents'),
19724
+ PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/property-documents'),
19725
+ PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/property-documents\\/\\d+'),
19726
+ PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/property-documents\\/\\d+'),
19681
19727
  PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
19682
19728
  PROPERTIES_SALES_GET: new Endpoint('GET', '\\/properties\\/sales'),
19683
19729
  PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),