taxtank-core 0.30.122 → 0.30.124

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.
@@ -2127,6 +2127,56 @@ __decorate([
2127
2127
  Type(() => Country)
2128
2128
  ], Phone.prototype, "country", void 0);
2129
2129
 
2130
+ var MyAccountHistoryInitiatedByEnum;
2131
+ (function (MyAccountHistoryInitiatedByEnum) {
2132
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
2133
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
2134
+ })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
2135
+
2136
+ var MyAccountHistoryStatusEnum;
2137
+ (function (MyAccountHistoryStatusEnum) {
2138
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
2139
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
2140
+ })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
2141
+
2142
+ var MyAccountHistoryTypeEnum;
2143
+ (function (MyAccountHistoryTypeEnum) {
2144
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
2145
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
2146
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
2147
+ })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
2148
+
2149
+ class MyAccountHistory {
2150
+ }
2151
+
2152
+ class Occupation extends Occupation$1 {
2153
+ }
2154
+
2155
+ /**
2156
+ * role hierarchy
2157
+ */
2158
+ const USER_ROLES = {
2159
+ ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
2160
+ ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
2161
+ ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
2162
+ ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
2163
+ ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
2164
+ // @TODO makes no sense, these roles can't be hierarchical
2165
+ ROLE_CLIENT: [UserRolesEnum.CLIENT],
2166
+ ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
2167
+ ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
2168
+ ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
2169
+ ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
2170
+ ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
2171
+ ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
2172
+ };
2173
+
2174
+ /**
2175
+ * Class with basic information about registering user
2176
+ */
2177
+ class UserToRegister {
2178
+ }
2179
+
2130
2180
  class Firm extends Firm$1 {
2131
2181
  /**
2132
2182
  * get firm photo link
@@ -4319,56 +4369,6 @@ class DepreciationReceipt extends DepreciationReceipt$1 {
4319
4369
  }
4320
4370
  }
4321
4371
 
4322
- var MyAccountHistoryInitiatedByEnum;
4323
- (function (MyAccountHistoryInitiatedByEnum) {
4324
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
4325
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
4326
- })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
4327
-
4328
- var MyAccountHistoryStatusEnum;
4329
- (function (MyAccountHistoryStatusEnum) {
4330
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
4331
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
4332
- })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
4333
-
4334
- var MyAccountHistoryTypeEnum;
4335
- (function (MyAccountHistoryTypeEnum) {
4336
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
4337
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
4338
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
4339
- })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
4340
-
4341
- class MyAccountHistory {
4342
- }
4343
-
4344
- class Occupation extends Occupation$1 {
4345
- }
4346
-
4347
- /**
4348
- * role hierarchy
4349
- */
4350
- const USER_ROLES = {
4351
- ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4352
- ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4353
- ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4354
- ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
4355
- ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
4356
- // @TODO makes no sense, these roles can't be hierarchical
4357
- ROLE_CLIENT: [UserRolesEnum.CLIENT],
4358
- ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
4359
- ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
4360
- ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
4361
- ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
4362
- ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
4363
- ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
4364
- };
4365
-
4366
- /**
4367
- * Class with basic information about registering user
4368
- */
4369
- class UserToRegister {
4370
- }
4371
-
4372
4372
  class SoleBusinessAllocation extends SoleBusinessAllocation$1 {
4373
4373
  }
4374
4374
  __decorate([
@@ -10450,9 +10450,6 @@ class BasiqService extends RestService$1 {
10450
10450
  * Get Basiq job result
10451
10451
  */
10452
10452
  retrieveJob(jobId) {
10453
- // if we get a jobId then we know that user accepted basiq consent
10454
- // @TODO Nikita (TT-3308): if user close the tab before redirect then consent exist in basiq but not in database
10455
- this.updateBasiqConsentAgreement();
10456
10453
  return this.http.get(`${BasiqService.basiqApiUrl}/jobs/${jobId}`)
10457
10454
  .pipe(map((response) => plainToClass(BasiqJobResponse, response)));
10458
10455
  }
@@ -10489,14 +10486,6 @@ class BasiqService extends RestService$1 {
10489
10486
  return response.getRetrieveAccountsStep().isSuccess();
10490
10487
  }));
10491
10488
  }
10492
- /**
10493
- * Ask backend to update user's basiq consent flag
10494
- */
10495
- updateBasiqConsentAgreement() {
10496
- this.http.put(`${this.environment.apiV2}/basiq/consents`, {}).subscribe((result) => {
10497
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_CONSENT_UPDATED, result));
10498
- });
10499
- }
10500
10489
  /**
10501
10490
  * listen to notifications to update basiq accounts list
10502
10491
  */
@@ -12283,6 +12272,9 @@ class TaxSummary {
12283
12272
  get sections() {
12284
12273
  return [this.work, this.property, this.other, this.sole, this.summary];
12285
12274
  }
12275
+ getReportItems(sections) {
12276
+ return new ReportItemCollection([].concat(...this.sections.map((section) => section.items.toArray())));
12277
+ }
12286
12278
  get taxPercent() {
12287
12279
  // Check if netAmount is not 0 to avoid division by zero
12288
12280
  if (!this.summary.netAmount) {
@@ -12298,6 +12290,13 @@ class TaxSummary {
12298
12290
  const taxWithheld = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.taxWithheld, TaxSummarySectionEnum.WORK_TANK);
12299
12291
  return this.workNetTotal - Math.abs(taxWithheld);
12300
12292
  }
12293
+ get income() {
12294
+ return this.getReportItems([this.work, this.property, this.other]).sumByCategories([
12295
+ ...TAX_RETURN_CATEGORIES.work.income,
12296
+ ...TAX_RETURN_CATEGORIES.property.income,
12297
+ ...TAX_RETURN_CATEGORIES.other.income,
12298
+ ]);
12299
+ }
12301
12300
  /**
12302
12301
  * Work Net Total = Income - expenses - interest
12303
12302
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
@@ -20265,6 +20264,16 @@ class AbstractForm extends UntypedFormGroup {
20265
20264
  !!this.model && !!this.model['id'] && isEqual(this.value, this.initialValue) ? this.markAsSaved() : this.markAsUnsaved();
20266
20265
  });
20267
20266
  }
20267
+ /**
20268
+ * upgraded version of patchValue to skip duplicated changes
20269
+ */
20270
+ patchField(name, value, distinctUntilChanged = true) {
20271
+ const control = this.get(name);
20272
+ if (distinctUntilChanged && control.value === value) {
20273
+ return;
20274
+ }
20275
+ control.patchValue(value);
20276
+ }
20268
20277
  }
20269
20278
 
20270
20279
  /**
@@ -22812,7 +22821,7 @@ class TransactionBaseForm extends AbstractForm {
22812
22821
  this.get('gstAmount').patchValue(this.amountWithGST - this.amount);
22813
22822
  }
22814
22823
  updateAmount() {
22815
- this.get('amount').patchValue(this.isGST ? this.amountWithGST / ChartAccounts.GSTCoefficient : this.amountWithGST);
22824
+ this.patchField('amount', this.isGST ? this.amountWithGST / ChartAccounts.GSTCoefficient : this.amountWithGST);
22816
22825
  }
22817
22826
  isGstApplicable() {
22818
22827
  return !!this.registeredForGst && !!this.model.business;