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
@@ -2287,6 +2287,12 @@ var DepreciationCalculationEnum;
2287
2287
  })(DepreciationCalculationEnum || (DepreciationCalculationEnum = {}));
2288
2288
 
2289
2289
  class DepreciationCapitalProject extends DepreciationCapitalProject$1 {
2290
+ getMpData(property) {
2291
+ return {
2292
+ 'Property': property.name,
2293
+ 'Name': this.projectName
2294
+ };
2295
+ }
2290
2296
  }
2291
2297
  __decorate([
2292
2298
  Type(() => Date)
@@ -3829,6 +3835,70 @@ __decorate([
3829
3835
  Type(() => Date)
3830
3836
  ], AssetSale.prototype, "date", void 0);
3831
3837
 
3838
+ var TaxExemptions = [
3839
+ {
3840
+ id: 1,
3841
+ name: "Apply 50% CGT Discount",
3842
+ 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",
3843
+ metaFields: [
3844
+ ]
3845
+ },
3846
+ {
3847
+ id: 2,
3848
+ name: "Full Exemption (Principle place of residence)",
3849
+ 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",
3850
+ metaFields: [
3851
+ ]
3852
+ },
3853
+ {
3854
+ id: 3,
3855
+ name: "Full Exemption (6 year rule)",
3856
+ 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",
3857
+ metaFields: [
3858
+ ]
3859
+ },
3860
+ {
3861
+ id: 4,
3862
+ name: "Partial exemption (investment property became your main residence)",
3863
+ 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",
3864
+ metaFields: [
3865
+ {
3866
+ id: 1,
3867
+ name: "Total amount of days the property was your main residence"
3868
+ }
3869
+ ]
3870
+ },
3871
+ {
3872
+ id: 5,
3873
+ name: "Main Residence became your 'investment property' or 'home office'",
3874
+ 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",
3875
+ metaFields: [
3876
+ {
3877
+ id: 2,
3878
+ name: "Market Value"
3879
+ },
3880
+ {
3881
+ id: 2,
3882
+ name: "Home office percentage claimed"
3883
+ }
3884
+ ]
3885
+ },
3886
+ {
3887
+ id: 6,
3888
+ name: "Property transfer (Relationship Breakdown)",
3889
+ 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",
3890
+ metaFields: [
3891
+ ]
3892
+ },
3893
+ {
3894
+ id: 7,
3895
+ name: "Full exemption (Other)",
3896
+ description: "In some other instances a full exemption may apply, for example pre-CGT assets and some inheritance",
3897
+ metaFields: [
3898
+ ]
3899
+ }
3900
+ ];
3901
+
3832
3902
  class PropertySale extends AssetSale {
3833
3903
  get saleCostsTotalAmount() {
3834
3904
  return this.commission + this.legalFees + this.otherCost;
@@ -3843,6 +3913,12 @@ class PropertySale extends AssetSale {
3843
3913
  get netPrice() {
3844
3914
  return this.price - this.saleCostsTotalAmount;
3845
3915
  }
3916
+ getMpData(property) {
3917
+ return {
3918
+ 'Property': property.name,
3919
+ 'Concession': TaxExemptions.find((taxExemption) => taxExemption.id === this.taxExemption.id).name
3920
+ };
3921
+ }
3846
3922
  }
3847
3923
  __decorate([
3848
3924
  Type(() => Number)
@@ -3878,12 +3954,30 @@ __decorate([
3878
3954
  Type(() => PropertySaleTaxExemptionMetaField$1)
3879
3955
  ], PropertySale.prototype, "taxExemptionMetaFields", void 0);
3880
3956
 
3881
- var UserStatusEnum;
3882
- (function (UserStatusEnum) {
3883
- UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
3884
- UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
3885
- UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
3886
- })(UserStatusEnum || (UserStatusEnum = {}));
3957
+ var MyAccountHistoryInitiatedByEnum;
3958
+ (function (MyAccountHistoryInitiatedByEnum) {
3959
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
3960
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
3961
+ })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
3962
+
3963
+ var MyAccountHistoryStatusEnum;
3964
+ (function (MyAccountHistoryStatusEnum) {
3965
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
3966
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
3967
+ })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
3968
+
3969
+ var MyAccountHistoryTypeEnum;
3970
+ (function (MyAccountHistoryTypeEnum) {
3971
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
3972
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
3973
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
3974
+ })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
3975
+
3976
+ class MyAccountHistory {
3977
+ }
3978
+
3979
+ class Occupation extends Occupation$1 {
3980
+ }
3887
3981
 
3888
3982
  var UserRolesEnum;
3889
3983
  (function (UserRolesEnum) {
@@ -3902,12 +3996,44 @@ var UserRolesEnum;
3902
3996
  UserRolesEnum["SWITCH_USER"] = "IS_IMPERSONATOR";
3903
3997
  })(UserRolesEnum || (UserRolesEnum = {}));
3904
3998
 
3999
+ /**
4000
+ * role hierarchy
4001
+ */
4002
+ const USER_ROLES = {
4003
+ ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4004
+ ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4005
+ ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4006
+ ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
4007
+ ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
4008
+ // @TODO makes no sense, these roles can't be hierarchical
4009
+ ROLE_CLIENT: [UserRolesEnum.CLIENT],
4010
+ ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
4011
+ ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
4012
+ ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
4013
+ ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
4014
+ ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
4015
+ ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
4016
+ };
4017
+
4018
+ /**
4019
+ * Class with basic information about registering user
4020
+ */
4021
+ class UserToRegister {
4022
+ }
4023
+
3905
4024
  const USER_WORK_POSITION = {
3906
4025
  [UserRolesEnum.EMPLOYEE]: 'Employee',
3907
4026
  [UserRolesEnum.FIRM_MANAGER]: 'Manager',
3908
4027
  [UserRolesEnum.FIRM_OWNER]: 'Firm Owner'
3909
4028
  };
3910
4029
 
4030
+ var UserStatusEnum;
4031
+ (function (UserStatusEnum) {
4032
+ UserStatusEnum[UserStatusEnum["INACTIVE"] = 0] = "INACTIVE";
4033
+ UserStatusEnum[UserStatusEnum["ON_BOARDING"] = 1] = "ON_BOARDING";
4034
+ UserStatusEnum[UserStatusEnum["ACTIVE"] = 2] = "ACTIVE";
4035
+ })(UserStatusEnum || (UserStatusEnum = {}));
4036
+
3911
4037
  class ClientDetails extends ClientDetails$1 {
3912
4038
  }
3913
4039
 
@@ -3920,7 +4046,7 @@ class AnnualClientDetails extends AbstractModel {
3920
4046
  get spouseMonthlyIncome() {
3921
4047
  return this.spouseAnnualIncome / 12;
3922
4048
  }
3923
- get mpData() {
4049
+ getMpData() {
3924
4050
  return {
3925
4051
  capitalLoss: this.capitalLoss,
3926
4052
  privateHealthCare: this.privateHealthCare,
@@ -3944,7 +4070,7 @@ class ClientIncomeTypes extends ClientIncomeTypes$1 {
3944
4070
  get length() {
3945
4071
  return Object.values(this).filter((value) => typeof value === 'boolean' && value).length;
3946
4072
  }
3947
- get mpData() {
4073
+ getMpData() {
3948
4074
  return { work: this.work, property: this.property, sole: this.sole, holding: this.holdings };
3949
4075
  }
3950
4076
  }
@@ -3987,56 +4113,6 @@ __decorate([
3987
4113
  Type(() => Country)
3988
4114
  ], Phone.prototype, "country", void 0);
3989
4115
 
3990
- var MyAccountHistoryInitiatedByEnum;
3991
- (function (MyAccountHistoryInitiatedByEnum) {
3992
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
3993
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
3994
- })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
3995
-
3996
- var MyAccountHistoryStatusEnum;
3997
- (function (MyAccountHistoryStatusEnum) {
3998
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
3999
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
4000
- })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
4001
-
4002
- var MyAccountHistoryTypeEnum;
4003
- (function (MyAccountHistoryTypeEnum) {
4004
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
4005
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
4006
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
4007
- })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
4008
-
4009
- class MyAccountHistory {
4010
- }
4011
-
4012
- class Occupation extends Occupation$1 {
4013
- }
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
-
4040
4116
  var FirmTypeEnum;
4041
4117
  (function (FirmTypeEnum) {
4042
4118
  FirmTypeEnum[FirmTypeEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
@@ -5285,7 +5361,7 @@ class User extends User$1 {
5285
5361
  get financialYears() {
5286
5362
  return range(Math.min(FinancialYear.toFinYear(this.createdAt) - 1, 2022), FinancialYear.toFinYear(new Date()) + 1);
5287
5363
  }
5288
- get mpData() {
5364
+ getMpData() {
5289
5365
  return {
5290
5366
  clientDetails: {}
5291
5367
  };
@@ -5346,12 +5422,22 @@ class PropertyCategory extends PropertyCategory$1 {
5346
5422
  isShared() {
5347
5423
  return this.id === PropertyCategoryListEnum.SHARED;
5348
5424
  }
5425
+ getMpData() {
5426
+ return {
5427
+ 'Name': this.name
5428
+ };
5429
+ }
5349
5430
  }
5350
5431
 
5351
5432
  class PropertyDocument extends PropertyDocument$1 {
5352
5433
  get parent() {
5353
5434
  return this.property;
5354
5435
  }
5436
+ getMpData(property) {
5437
+ return {
5438
+ 'Property': property.name
5439
+ };
5440
+ }
5355
5441
  }
5356
5442
  __decorate([
5357
5443
  Type(() => Property)
@@ -5367,6 +5453,12 @@ class PropertyValuation extends PropertyValuation$1 {
5367
5453
  isCurrentYear() {
5368
5454
  return this.financialYear === new FinancialYear(new Date()).year;
5369
5455
  }
5456
+ getMpData(property) {
5457
+ return {
5458
+ 'Property': property.name,
5459
+ 'Date': this.date
5460
+ };
5461
+ }
5370
5462
  }
5371
5463
  __decorate([
5372
5464
  Type(() => Date)
@@ -5410,6 +5502,12 @@ class PropertyForecast extends PropertyForecast$1 {
5410
5502
  isCurrentYear() {
5411
5503
  return this.financialYear === new FinancialYear(new Date()).year;
5412
5504
  }
5505
+ getMpData(property) {
5506
+ return {
5507
+ 'Property': property.name,
5508
+ 'Financial Year': this.financialYear,
5509
+ };
5510
+ }
5413
5511
  }
5414
5512
  __decorate([
5415
5513
  Transform(({ value }) => +value)
@@ -5431,6 +5529,12 @@ __decorate([
5431
5529
  ], PropertyForecast.prototype, "marketValue", void 0);
5432
5530
 
5433
5531
  class PropertyCategoryMovement extends PropertyCategoryMovement$1 {
5532
+ getMpData(property) {
5533
+ return {
5534
+ 'Property': property.name,
5535
+ 'Category': this.propertyCategory.name
5536
+ };
5537
+ }
5434
5538
  }
5435
5539
  __decorate([
5436
5540
  Type(() => PropertyValuation)
@@ -5630,6 +5734,14 @@ class Property extends Property$1 {
5630
5734
  get monthlyExpense() {
5631
5735
  return this.currentYearForecast.expense / 12;
5632
5736
  }
5737
+ getMpData() {
5738
+ return {
5739
+ 'Category': this.category.name,
5740
+ 'Taxable': this.category.isTaxInclusive ? 'Yes' : 'No',
5741
+ 'Shared': this.isShared ? 'Yes' : 'No',
5742
+ 'Ownership %': `${this.myShare.percent}%`
5743
+ };
5744
+ }
5633
5745
  }
5634
5746
  /**
5635
5747
  * Property acquired before 20 September 1985 will generally be treated as pre-Capital Gains Tax (CGT) assets.
@@ -5993,6 +6105,12 @@ class PropertyShare extends PropertyShare$1 {
5993
6105
  get userName() {
5994
6106
  return this.user ? this.user.fullName : `${this.invite.firstName}`;
5995
6107
  }
6108
+ getMpData() {
6109
+ return {
6110
+ 'Property': this.property.name,
6111
+ 'User': this.user.email
6112
+ };
6113
+ }
5996
6114
  }
5997
6115
  __decorate([
5998
6116
  Type(() => Date)
@@ -9870,12 +9988,18 @@ __decorate([
9870
9988
  ], Notification.prototype, "redirectionLink", void 0);
9871
9989
 
9872
9990
  class DocumentFolder extends DocumentFolder$1 {
9991
+ getMpData() {
9992
+ return { 'Name': this.name };
9993
+ }
9873
9994
  }
9874
9995
 
9875
9996
  class Document extends Document$1 {
9876
9997
  get parent() {
9877
9998
  return this.folder;
9878
9999
  }
10000
+ getMpData() {
10001
+ return {};
10002
+ }
9879
10003
  }
9880
10004
  __decorate([
9881
10005
  Type(() => DocumentFolder)
@@ -10107,7 +10231,7 @@ class Budget extends Budget$1 {
10107
10231
  get rulesCollection() {
10108
10232
  return new Collection(this.rules);
10109
10233
  }
10110
- get mpData() {
10234
+ getMpData() {
10111
10235
  return {};
10112
10236
  }
10113
10237
  }
@@ -10495,15 +10619,15 @@ let RestService$1 = class RestService extends DataService {
10495
10619
  /**
10496
10620
  * Create a new Model instance in database
10497
10621
  */
10498
- post(model, path = this.apiUrl) {
10622
+ post(model, mpData, path = this.apiUrl) {
10499
10623
  this.handleAccessError('post');
10500
10624
  return this.http.post(path, classToPlain(model))
10501
10625
  .pipe(map((response) => {
10502
10626
  const result = this.createModelInstance(response);
10503
- this.handleResponse([result], 'post');
10627
+ this.handleResponse([result], 'post', mpData);
10504
10628
  return result;
10505
10629
  }), catchError((error) => {
10506
- this.handleResponseError([model], 'post');
10630
+ this.handleResponseError([model], 'post', mpData);
10507
10631
  return throwError(error);
10508
10632
  }));
10509
10633
  }
@@ -10525,15 +10649,15 @@ let RestService$1 = class RestService extends DataService {
10525
10649
  /**
10526
10650
  * Change an existing Model instance in database
10527
10651
  */
10528
- put(model, path = `${this.apiUrl}/${model.id}`) {
10652
+ put(model, mpData, path = `${this.apiUrl}/${model.id}`) {
10529
10653
  this.handleAccessError('put');
10530
10654
  return this.http.put(path, classToPlain(model))
10531
10655
  .pipe(map((response) => {
10532
10656
  const result = this.createModelInstance(response);
10533
- this.handleResponse([result], 'put');
10657
+ this.handleResponse([result], 'put', mpData);
10534
10658
  return result;
10535
10659
  }), catchError((error) => {
10536
- this.handleResponseError([model], 'put');
10660
+ this.handleResponseError([model], 'put', mpData);
10537
10661
  return throwError(error);
10538
10662
  }));
10539
10663
  }
@@ -10555,13 +10679,13 @@ let RestService$1 = class RestService extends DataService {
10555
10679
  /**
10556
10680
  * Remove a Model instance from database
10557
10681
  */
10558
- delete(model) {
10682
+ delete(model, mpData) {
10559
10683
  this.handleAccessError('delete');
10560
10684
  return this.http.delete(`${this.apiUrl}/${model.id}`)
10561
10685
  .pipe(map(() => {
10562
- this.handleResponse([model], 'delete');
10686
+ this.handleResponse([model], 'delete', mpData);
10563
10687
  }), catchError((error) => {
10564
- this.handleResponseError([model], 'delete');
10688
+ this.handleResponseError([model], 'delete', mpData);
10565
10689
  return throwError(error);
10566
10690
  }));
10567
10691
  }
@@ -10578,23 +10702,23 @@ let RestService$1 = class RestService extends DataService {
10578
10702
  return throwError(error);
10579
10703
  }));
10580
10704
  }
10581
- track(response, method, postfix = '') {
10582
- // not other way to check interface
10583
- if ('mpData' in response[0]) {
10705
+ track(response, method, mpData, postfix = '') {
10706
+ // no other way to check interface
10707
+ if ('getMpData' in response[0]) {
10584
10708
  response.forEach((model) => {
10585
- this.mpService.track(`${method}${this.modelClass.name}${postfix}`, model['mpData']);
10709
+ this.mpService.track(`${method}${this.modelClass.name}${postfix}`, model['getMpData'](mpData));
10586
10710
  });
10587
10711
  }
10588
10712
  }
10589
- handleResponseError(response, method) {
10713
+ handleResponseError(response, method, mpData) {
10590
10714
  // @TODO error notification?
10591
- this.track(response, method, 'Error');
10715
+ this.track(response, method, mpData, 'Error');
10592
10716
  }
10593
10717
  /**
10594
10718
  * Handle response data - update cache and dispatch event if it is needed
10595
10719
  */
10596
- handleResponse(response, method) {
10597
- this.track(response, method);
10720
+ handleResponse(response, method, mpData) {
10721
+ this.track(response, method, mpData);
10598
10722
  if (this.getCache()) {
10599
10723
  this.updateCache(response, method);
10600
10724
  }
@@ -10897,10 +11021,10 @@ class BankConnectionService extends RestService$1 {
10897
11021
  }));
10898
11022
  }
10899
11023
  activate(bankConnection) {
10900
- return this.put(bankConnection, `${this.apiUrl}/${bankConnection.id}/activate`);
11024
+ return this.put(bankConnection, null, `${this.apiUrl}/${bankConnection.id}/activate`);
10901
11025
  }
10902
11026
  deactivate(bankConnection) {
10903
- return this.put(bankConnection, `${this.apiUrl}/${bankConnection.id}/deactivate`);
11027
+ return this.put(bankConnection, null, `${this.apiUrl}/${bankConnection.id}/deactivate`);
10904
11028
  }
10905
11029
  /**
10906
11030
  * connection's status updated in background on backend, so reset cache required to inform user
@@ -11338,12 +11462,6 @@ class ChatService extends RestService$1 {
11338
11462
  this.listenChats();
11339
11463
  this.listenMessages();
11340
11464
  }
11341
- /**
11342
- * We don't need chats with taxtank employees
11343
- */
11344
- setCache(data, next = false) {
11345
- super.setCache(data.filter((data) => data.employee.email !== this.environment.ttAccountant && data.employee.email !== this.environment.ttAdvisor), next);
11346
- }
11347
11465
  /**
11348
11466
  * Listen chats events
11349
11467
  */
@@ -11617,55 +11735,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
11617
11735
 
11618
11736
  /**
11619
11737
  * Service for work with DepreciationCapitalProjects
11738
+ * @TODO Alex: refactor with new rest when backend ready (TT-3571)
11620
11739
  */
11621
- class DepreciationCapitalProjectService {
11622
- constructor(http, environment) {
11623
- this.http = http;
11624
- this.environment = environment;
11625
- this.cacheSubject = new ReplaySubject(1);
11626
- }
11627
- get(propertyId) {
11628
- this.cacheSubject.next([]);
11629
- this.http.get(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects`)
11630
- .subscribe((capitalProjectsBase) => {
11631
- this.cache = capitalProjectsBase.map((capitalProjectBase) => plainToClass(DepreciationCapitalProject, capitalProjectBase));
11632
- this.cacheSubject.next(this.cache);
11633
- });
11634
- return this.cacheSubject.asObservable();
11635
- }
11636
- add(capitalProject, propertyId) {
11637
- return this.http.post(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects`, capitalProject)
11638
- .pipe(map((capitalProjectBase) => {
11639
- this.cache.push(plainToClass(DepreciationCapitalProject, capitalProjectBase));
11640
- this.cacheSubject.next(this.cache);
11641
- }));
11642
- }
11643
- update(capitalProject, propertyId) {
11644
- return this.http.put(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects/${capitalProject.id}`, capitalProject)
11645
- .pipe(map((capitalProjectBase) => {
11646
- replace(this.cache, plainToClass(DepreciationCapitalProject, capitalProjectBase));
11647
- this.cacheSubject.next(this.cache);
11648
- }));
11649
- }
11650
- delete(capitalProject, propertyId) {
11651
- return this.http.delete(`${this.environment.apiV2}/properties/${propertyId}/depreciation-capital-projects/${capitalProject.id}`)
11652
- .pipe(map(() => {
11653
- this.cache = this.cache.filter((item) => capitalProject.id !== item.id);
11654
- this.cacheSubject.next(this.cache);
11655
- }));
11740
+ class DepreciationCapitalProjectService extends RestService$1 {
11741
+ constructor() {
11742
+ super(...arguments);
11743
+ this.modelClass = DepreciationCapitalProject;
11744
+ this.collectionClass = Collection;
11745
+ this.endpointUri = 'depreciation-capital-projects';
11746
+ this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
11656
11747
  }
11657
11748
  }
11658
- 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 });
11749
+ DepreciationCapitalProjectService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
11659
11750
  DepreciationCapitalProjectService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, providedIn: 'root' });
11660
11751
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DepreciationCapitalProjectService, decorators: [{
11661
11752
  type: Injectable,
11662
11753
  args: [{
11663
11754
  providedIn: 'root'
11664
11755
  }]
11665
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
11666
- type: Inject,
11667
- args: ['environment']
11668
- }] }]; } });
11756
+ }] });
11669
11757
 
11670
11758
  var DocumentFolderMessagesEnum;
11671
11759
  (function (DocumentFolderMessagesEnum) {
@@ -12322,6 +12410,8 @@ var ClientInviteMessages;
12322
12410
  ClientInviteMessages["REVOKE_TT_ADVISOR_CONFIRM"] = "Are you sure you want to revoke access?";
12323
12411
  ClientInviteMessages["TT_ADVISOR_REVOKED"] = "Access revoked";
12324
12412
  ClientInviteMessages["TT_INVITE_ACCEPT"] = "You successfully accepted the invitation";
12413
+ ClientInviteMessages["SEND_INVITE_MESSAGES_TITLE"] = "TaxTank support is here to help";
12414
+ ClientInviteMessages["SEND_INVITE_MESSAGES_DESCRIPTION"] = "Before inviting TaxTank support be sure to check out our help articles and message our support team.";
12325
12415
  ClientInviteMessages["TT_ACCOUNTANT_INVITED"] = "Accountant invitation has been sent successfully";
12326
12416
  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.";
12327
12417
  })(ClientInviteMessages || (ClientInviteMessages = {}));
@@ -13126,8 +13216,8 @@ class PropertyCategoryMovementService extends RestService$1 {
13126
13216
  this.endpointUri = 'properties/category-movements';
13127
13217
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
13128
13218
  }
13129
- post(movement) {
13130
- return super.post(movement, `${this.environment.apiV2}/properties/${movement.property.id}/category-movements`);
13219
+ post(movement, property) {
13220
+ return super.post(movement, property, `${this.environment.apiV2}/properties/${movement.property.id}/category-movements`);
13131
13221
  }
13132
13222
  }
13133
13223
  PropertyCategoryMovementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: PropertyCategoryMovementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -13192,70 +13282,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImpor
13192
13282
  }]
13193
13283
  }] });
13194
13284
 
13195
- var TaxExemptions = [
13196
- {
13197
- id: 1,
13198
- name: "Apply 50% CGT Discount",
13199
- 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",
13200
- metaFields: [
13201
- ]
13202
- },
13203
- {
13204
- id: 2,
13205
- name: "Full Exemption (Principle place of residence)",
13206
- 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",
13207
- metaFields: [
13208
- ]
13209
- },
13210
- {
13211
- id: 3,
13212
- name: "Full Exemption (6 year rule)",
13213
- 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",
13214
- metaFields: [
13215
- ]
13216
- },
13217
- {
13218
- id: 4,
13219
- name: "Partial exemption (investment property became your main residence)",
13220
- 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",
13221
- metaFields: [
13222
- {
13223
- id: 1,
13224
- name: "Total amount of days the property was your main residence"
13225
- }
13226
- ]
13227
- },
13228
- {
13229
- id: 5,
13230
- name: "Main Residence became your 'investment property' or 'home office'",
13231
- 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",
13232
- metaFields: [
13233
- {
13234
- id: 2,
13235
- name: "Market Value"
13236
- },
13237
- {
13238
- id: 2,
13239
- name: "Home office percentage claimed"
13240
- }
13241
- ]
13242
- },
13243
- {
13244
- id: 6,
13245
- name: "Property transfer (Relationship Breakdown)",
13246
- 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",
13247
- metaFields: [
13248
- ]
13249
- },
13250
- {
13251
- id: 7,
13252
- name: "Full exemption (Other)",
13253
- description: "In some other instances a full exemption may apply, for example pre-CGT assets and some inheritance",
13254
- metaFields: [
13255
- ]
13256
- }
13257
- ];
13258
-
13259
13285
  class TaxExemptionService extends DataService {
13260
13286
  constructor() {
13261
13287
  super();
@@ -13313,7 +13339,13 @@ class PropertyShareService extends RestService$1 {
13313
13339
  * @param share user to share property
13314
13340
  */
13315
13341
  reinvite(share) {
13316
- return this.http.post(`${this.apiUrl}/${share.id}/reinvite`, {});
13342
+ return this.http.post(`${this.apiUrl}/${share.id}/reinvite`, {})
13343
+ .pipe(map(() => {
13344
+ this.mpService.track('reinvitePropertyShare', share.getMpData());
13345
+ }), catchError((error) => {
13346
+ this.mpService.track('reinvitePropertyShareError', share.getMpData());
13347
+ return throwError(error);
13348
+ }));
13317
13349
  }
13318
13350
  /**
13319
13351
  * Listen to User updated event
@@ -13355,11 +13387,11 @@ class PropertyValuationService extends RestService$1 {
13355
13387
  return this.http.get(`${this.apiUrl}/${propertyId}/valuations`)
13356
13388
  .pipe(map((valuations) => new Collection(valuations.map((valuation) => plainToClass(PropertyValuation, valuation)))));
13357
13389
  }
13358
- post(valuation, propertyId) {
13359
- return super.post(valuation, `${this.apiUrl}/${propertyId}/valuations`);
13390
+ post(valuation, property) {
13391
+ return super.post(valuation, property, `${this.apiUrl}/${property.id}/valuations`);
13360
13392
  }
13361
- put(valuation, propertyId) {
13362
- return super.put(valuation, `${this.apiUrl}/${propertyId}/valuations/${valuation.id}`);
13393
+ put(valuation, property) {
13394
+ return super.put(valuation, property, `${this.apiUrl}/${property.id}/valuations/${valuation.id}`);
13363
13395
  }
13364
13396
  }
13365
13397
  PropertyValuationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: PropertyValuationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
@@ -13452,7 +13484,15 @@ class PropertyService extends RestService$1 {
13452
13484
  .pipe(map((propertySubscriptionBase) => {
13453
13485
  const newPropertySubscription = plainToClass(PropertySubscription, propertySubscriptionBase);
13454
13486
  const activatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [newPropertySubscription] }));
13487
+ this.mpService.track(`postPropertySubscription`, {
13488
+ 'Property': property.name,
13489
+ });
13455
13490
  this.updateCache([activatedProperty], 'put');
13491
+ }), catchError((error) => {
13492
+ this.mpService.track('postPropertySubscriptionError', {
13493
+ 'Property': property.name,
13494
+ });
13495
+ return throwError(error);
13456
13496
  }));
13457
13497
  }
13458
13498
  /**
@@ -13462,7 +13502,15 @@ class PropertyService extends RestService$1 {
13462
13502
  return this.http.delete(`${this.environment.apiV2}/property-subscriptions/${property.getCurrentSubscription().id}`)
13463
13503
  .pipe(map(() => {
13464
13504
  const deactivatedProperty = plainToClass(Property, Object.assign({}, property, { subscriptions: [] }));
13505
+ this.mpService.track(`deletePropertySubscription`, {
13506
+ 'Property': property.name,
13507
+ });
13465
13508
  this.updateCache([deactivatedProperty], 'put');
13509
+ }), catchError((error) => {
13510
+ this.mpService.track('deletePropertySubscriptionError', {
13511
+ 'Property': property.name,
13512
+ });
13513
+ return throwError(error);
13466
13514
  }));
13467
13515
  }
13468
13516
  /**
@@ -15353,7 +15401,7 @@ class UserEventSetting extends UserEventSetting$1 {
15353
15401
  // flag indicates that the setting is updating now saved or not
15354
15402
  this.isUpdating = false;
15355
15403
  }
15356
- get mpData() {
15404
+ getMpData() {
15357
15405
  return { type: this.type.name, byEmail: this.byEmail, byNotification: this.byNotification, frequency: this.type.frequencyLabel };
15358
15406
  }
15359
15407
  }
@@ -15511,7 +15559,7 @@ class UserService extends RestService$1 {
15511
15559
  return this.http.get(`${this.apiUrl}/search`, { params: { email } }).pipe(map((userBase) => this.createModelInstance(userBase)));
15512
15560
  }
15513
15561
  finishOnboarding(user) {
15514
- return this.put(user, `${this.apiUrl}/status`);
15562
+ return this.put(user, null, `${this.apiUrl}/status`);
15515
15563
  }
15516
15564
  updatePhoto(photo) {
15517
15565
  return this.http.post(`${this.apiUrl}/photo?_method=PUT`, photo).pipe(map((photoUrl) => {
@@ -19540,10 +19588,10 @@ const ENDPOINTS = {
19540
19588
  PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/depreciation-capital-projects'),
19541
19589
  PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
19542
19590
  PROPERTIES_DEPRECIATION_CAPITAL_PROJECT_DELETE: new Endpoint('DELETE', '\\/properties\\/\\d+\\/depreciation-capital-projects\\/\\d+'),
19543
- PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/properties\\/documents'),
19544
- PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/documents'),
19545
- PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/properties\\/documents\\/\\d+'),
19546
- PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/properties\\/documents\\/\\d+'),
19591
+ PROPERTIES_DOCUMENTS_GET: new Endpoint('GET', '\\/property-documents'),
19592
+ PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/property-documents'),
19593
+ PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/property-documents\\/\\d+'),
19594
+ PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/property-documents\\/\\d+'),
19547
19595
  PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
19548
19596
  PROPERTIES_SALES_GET: new Endpoint('GET', '\\/properties\\/sales'),
19549
19597
  PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),