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.
@@ -2116,6 +2116,56 @@ __decorate([
2116
2116
  Type(() => Country)
2117
2117
  ], Phone.prototype, "country", void 0);
2118
2118
 
2119
+ var MyAccountHistoryInitiatedByEnum;
2120
+ (function (MyAccountHistoryInitiatedByEnum) {
2121
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
2122
+ MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
2123
+ })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
2124
+
2125
+ var MyAccountHistoryStatusEnum;
2126
+ (function (MyAccountHistoryStatusEnum) {
2127
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
2128
+ MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
2129
+ })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
2130
+
2131
+ var MyAccountHistoryTypeEnum;
2132
+ (function (MyAccountHistoryTypeEnum) {
2133
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
2134
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
2135
+ MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
2136
+ })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
2137
+
2138
+ class MyAccountHistory {
2139
+ }
2140
+
2141
+ class Occupation extends Occupation$1 {
2142
+ }
2143
+
2144
+ /**
2145
+ * role hierarchy
2146
+ */
2147
+ const USER_ROLES = {
2148
+ ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
2149
+ ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
2150
+ ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
2151
+ ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
2152
+ ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
2153
+ // @TODO makes no sense, these roles can't be hierarchical
2154
+ ROLE_CLIENT: [UserRolesEnum.CLIENT],
2155
+ ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
2156
+ ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
2157
+ ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
2158
+ ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
2159
+ ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
2160
+ ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
2161
+ };
2162
+
2163
+ /**
2164
+ * Class with basic information about registering user
2165
+ */
2166
+ class UserToRegister {
2167
+ }
2168
+
2119
2169
  class Firm extends Firm$1 {
2120
2170
  /**
2121
2171
  * get firm photo link
@@ -4300,56 +4350,6 @@ class DepreciationReceipt extends DepreciationReceipt$1 {
4300
4350
  }
4301
4351
  }
4302
4352
 
4303
- var MyAccountHistoryInitiatedByEnum;
4304
- (function (MyAccountHistoryInitiatedByEnum) {
4305
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
4306
- MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["ACCOUNTANT"] = 1] = "ACCOUNTANT";
4307
- })(MyAccountHistoryInitiatedByEnum || (MyAccountHistoryInitiatedByEnum = {}));
4308
-
4309
- var MyAccountHistoryStatusEnum;
4310
- (function (MyAccountHistoryStatusEnum) {
4311
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["SUCCESS"] = 0] = "SUCCESS";
4312
- MyAccountHistoryStatusEnum[MyAccountHistoryStatusEnum["ERROR"] = 1] = "ERROR";
4313
- })(MyAccountHistoryStatusEnum || (MyAccountHistoryStatusEnum = {}));
4314
-
4315
- var MyAccountHistoryTypeEnum;
4316
- (function (MyAccountHistoryTypeEnum) {
4317
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["REVIEW"] = 0] = "REVIEW";
4318
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPGRADE_PLAN"] = 1] = "UPGRADE_PLAN";
4319
- MyAccountHistoryTypeEnum[MyAccountHistoryTypeEnum["UPLOAD_DOCUMENT"] = 2] = "UPLOAD_DOCUMENT";
4320
- })(MyAccountHistoryTypeEnum || (MyAccountHistoryTypeEnum = {}));
4321
-
4322
- class MyAccountHistory {
4323
- }
4324
-
4325
- class Occupation extends Occupation$1 {
4326
- }
4327
-
4328
- /**
4329
- * role hierarchy
4330
- */
4331
- const USER_ROLES = {
4332
- ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER, UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4333
- ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4334
- ROLE_EMPLOYEE: [UserRolesEnum.ACCOUNTANT, UserRolesEnum.ADVISOR],
4335
- ROLE_ACCOUNTANT: [UserRolesEnum.ACCOUNTANT],
4336
- ROLE_ADVISOR: [UserRolesEnum.ADVISOR],
4337
- // @TODO makes no sense, these roles can't be hierarchical
4338
- ROLE_CLIENT: [UserRolesEnum.CLIENT],
4339
- ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
4340
- ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
4341
- ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
4342
- ROLE_USER_SOLE: [UserRolesEnum.SOLE_TANK],
4343
- ROLE_USER_HOLDING: [UserRolesEnum.HOLDING_TANK],
4344
- ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER],
4345
- };
4346
-
4347
- /**
4348
- * Class with basic information about registering user
4349
- */
4350
- class UserToRegister {
4351
- }
4352
-
4353
4353
  class SoleBusinessAllocation extends SoleBusinessAllocation$1 {
4354
4354
  }
4355
4355
  __decorate([
@@ -10383,9 +10383,6 @@ class BasiqService extends RestService$1 {
10383
10383
  * Get Basiq job result
10384
10384
  */
10385
10385
  retrieveJob(jobId) {
10386
- // if we get a jobId then we know that user accepted basiq consent
10387
- // @TODO Nikita (TT-3308): if user close the tab before redirect then consent exist in basiq but not in database
10388
- this.updateBasiqConsentAgreement();
10389
10386
  return this.http.get(`${BasiqService.basiqApiUrl}/jobs/${jobId}`)
10390
10387
  .pipe(map((response) => plainToClass(BasiqJobResponse, response)));
10391
10388
  }
@@ -10422,14 +10419,6 @@ class BasiqService extends RestService$1 {
10422
10419
  return response.getRetrieveAccountsStep().isSuccess();
10423
10420
  }));
10424
10421
  }
10425
- /**
10426
- * Ask backend to update user's basiq consent flag
10427
- */
10428
- updateBasiqConsentAgreement() {
10429
- this.http.put(`${this.environment.apiV2}/basiq/consents`, {}).subscribe((result) => {
10430
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.BASIQ_CONSENT_UPDATED, result));
10431
- });
10432
- }
10433
10422
  /**
10434
10423
  * listen to notifications to update basiq accounts list
10435
10424
  */
@@ -12208,6 +12197,9 @@ class TaxSummary {
12208
12197
  get sections() {
12209
12198
  return [this.work, this.property, this.other, this.sole, this.summary];
12210
12199
  }
12200
+ getReportItems(sections) {
12201
+ return new ReportItemCollection([].concat(...this.sections.map((section) => section.items.toArray())));
12202
+ }
12211
12203
  get taxPercent() {
12212
12204
  // Check if netAmount is not 0 to avoid division by zero
12213
12205
  if (!this.summary.netAmount) {
@@ -12223,6 +12215,13 @@ class TaxSummary {
12223
12215
  const taxWithheld = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.taxWithheld, TaxSummarySectionEnum.WORK_TANK);
12224
12216
  return this.workNetTotal - Math.abs(taxWithheld);
12225
12217
  }
12218
+ get income() {
12219
+ return this.getReportItems([this.work, this.property, this.other]).sumByCategories([
12220
+ ...TAX_RETURN_CATEGORIES.work.income,
12221
+ ...TAX_RETURN_CATEGORIES.property.income,
12222
+ ...TAX_RETURN_CATEGORIES.other.income,
12223
+ ]);
12224
+ }
12226
12225
  /**
12227
12226
  * Work Net Total = Income - expenses - interest
12228
12227
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
@@ -20139,6 +20138,16 @@ class AbstractForm extends UntypedFormGroup {
20139
20138
  !!this.model && !!this.model['id'] && isEqual(this.value, this.initialValue) ? this.markAsSaved() : this.markAsUnsaved();
20140
20139
  });
20141
20140
  }
20141
+ /**
20142
+ * upgraded version of patchValue to skip duplicated changes
20143
+ */
20144
+ patchField(name, value, distinctUntilChanged = true) {
20145
+ const control = this.get(name);
20146
+ if (distinctUntilChanged && control.value === value) {
20147
+ return;
20148
+ }
20149
+ control.patchValue(value);
20150
+ }
20142
20151
  }
20143
20152
 
20144
20153
  /**
@@ -22674,7 +22683,7 @@ class TransactionBaseForm extends AbstractForm {
22674
22683
  this.get('gstAmount').patchValue(this.amountWithGST - this.amount);
22675
22684
  }
22676
22685
  updateAmount() {
22677
- this.get('amount').patchValue(this.isGST ? this.amountWithGST / ChartAccounts.GSTCoefficient : this.amountWithGST);
22686
+ this.patchField('amount', this.isGST ? this.amountWithGST / ChartAccounts.GSTCoefficient : this.amountWithGST);
22678
22687
  }
22679
22688
  isGstApplicable() {
22680
22689
  return !!this.registeredForGst && !!this.model.business;