taxtank-core 0.32.16 → 0.32.18

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 (176) hide show
  1. package/esm2022/lib/collections/collection.mjs +9 -3
  2. package/esm2022/lib/collections/property/index.mjs +2 -1
  3. package/esm2022/lib/collections/property/property-category-movement.collection.mjs +12 -4
  4. package/esm2022/lib/collections/property/property-valuation.collection.mjs +4 -0
  5. package/esm2022/lib/collections/property/property.collection.mjs +31 -33
  6. package/esm2022/lib/db/Models/firm/client-movement.mjs +3 -3
  7. package/esm2022/lib/db/Models/property/property.mjs +1 -1
  8. package/esm2022/lib/db/Models/user/registration-invite.mjs +1 -1
  9. package/esm2022/lib/forms/property/index.mjs +5 -1
  10. package/esm2022/lib/forms/property/property-add.form.mjs +69 -0
  11. package/esm2022/lib/forms/property/property-category-movement-form.mjs +22 -0
  12. package/esm2022/lib/forms/property/property-forecast.form.mjs +29 -0
  13. package/esm2022/lib/forms/property/property-share.form.mjs +16 -0
  14. package/esm2022/lib/forms/property/property-valuation.form.mjs +5 -3
  15. package/esm2022/lib/models/client/client-movement.mjs +3 -3
  16. package/esm2022/lib/models/depreciation/depreciation.mjs +1 -1
  17. package/esm2022/lib/models/endpoint/endpoints.const.mjs +10 -12
  18. package/esm2022/lib/models/event/app-event-type.enum.mjs +55 -57
  19. package/esm2022/lib/models/property/index.mjs +1 -2
  20. package/esm2022/lib/models/property/property-category-movement.mjs +5 -1
  21. package/esm2022/lib/models/property/property-valuation.mjs +1 -4
  22. package/esm2022/lib/models/property/property.mjs +15 -26
  23. package/esm2022/lib/services/data.service.mjs +2 -3
  24. package/esm2022/lib/services/event/sse.service.mjs +2 -2
  25. package/esm2022/lib/services/http/address/address.service.mjs +2 -2
  26. package/esm2022/lib/services/http/bank/bank-account/bank-account.service.mjs +8 -7
  27. package/esm2022/lib/services/http/bank/bank-connection/bank-connection.service.mjs +11 -20
  28. package/esm2022/lib/services/http/bank/bank-transaction/bank-transaction.service.mjs +11 -6
  29. package/esm2022/lib/services/http/bank/bank.service.mjs +1 -2
  30. package/esm2022/lib/services/http/bank/basiq/basiq.service.mjs +7 -7
  31. package/esm2022/lib/services/http/budget/budget.service.mjs +1 -2
  32. package/esm2022/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.mjs +1 -2
  33. package/esm2022/lib/services/http/chat/chat.service.mjs +11 -13
  34. package/esm2022/lib/services/http/chat/message-document.service.mjs +13 -9
  35. package/esm2022/lib/services/http/chat/message.service.mjs +9 -41
  36. package/esm2022/lib/services/http/client/capital-gain/annual-client-details.service.mjs +1 -2
  37. package/esm2022/lib/services/http/depreciation/depreciation.service.mjs +6 -5
  38. package/esm2022/lib/services/http/document/document.service.mjs +1 -2
  39. package/esm2022/lib/services/http/file/file.service.mjs +1 -2
  40. package/esm2022/lib/services/http/firm/client-income/client-income-types.service.mjs +1 -2
  41. package/esm2022/lib/services/http/firm/client-invite/client-invite.service.mjs +17 -31
  42. package/esm2022/lib/services/http/firm/client-movement/client-movement.service.mjs +21 -25
  43. package/esm2022/lib/services/http/firm/firm.service.mjs +2 -2
  44. package/esm2022/lib/services/http/firm/portfolio-report/client-portfolio-report.service.mjs +1 -1
  45. package/esm2022/lib/services/http/holding/holding-sale.service.mjs +1 -2
  46. package/esm2022/lib/services/http/holding/holding-type.service.mjs +1 -2
  47. package/esm2022/lib/services/http/holding/holding.service.mjs +12 -8
  48. package/esm2022/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.mjs +12 -7
  49. package/esm2022/lib/services/http/income-source/income-source.service.mjs +12 -7
  50. package/esm2022/lib/services/http/income-source/salary-forecast/salary-forecast.service.mjs +12 -10
  51. package/esm2022/lib/services/http/income-source/sole-forecast/sole-forecast.service.mjs +12 -10
  52. package/esm2022/lib/services/http/loan/borrowing-expense/borrowing-expense.service.mjs +1 -1
  53. package/esm2022/lib/services/http/loan/loan.service.mjs +14 -9
  54. package/esm2022/lib/services/http/property/borrowing-report/borrowing-report.service.mjs +1 -2
  55. package/esm2022/lib/services/http/property/property-category-movement/property-category-movement.service.mjs +6 -4
  56. package/esm2022/lib/services/http/property/property-document/property-document.service.mjs +2 -28
  57. package/esm2022/lib/services/http/property/property-share/property-share.service.mjs +12 -7
  58. package/esm2022/lib/services/http/property/property-valuation/property-valuation.service.mjs +5 -16
  59. package/esm2022/lib/services/http/property/property.service.mjs +26 -50
  60. package/esm2022/lib/services/http/rest/rest-old.service.mjs +13 -19
  61. package/esm2022/lib/services/http/rest/rest.service.mjs +53 -34
  62. package/esm2022/lib/services/http/service-notification/service-notification.service.mjs +16 -18
  63. package/esm2022/lib/services/http/setup-item/setup-item.service.mjs +1 -2
  64. package/esm2022/lib/services/http/sole/bas-report/bas-report.service.mjs +1 -2
  65. package/esm2022/lib/services/http/sole/sole-business/sole-business.service.mjs +2 -4
  66. package/esm2022/lib/services/http/sole/sole-business-activity/sole-business-activity.service.mjs +1 -2
  67. package/esm2022/lib/services/http/sole/sole-business-loss/sole-business-loss-rules/sole-business-loss-offset-rule.service.mjs +1 -2
  68. package/esm2022/lib/services/http/sole/sole-business-loss/sole-business-loss.service.mjs +12 -8
  69. package/esm2022/lib/services/http/sole/sole-contact/sole-contact.service.mjs +1 -2
  70. package/esm2022/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.mjs +7 -7
  71. package/esm2022/lib/services/http/sole/sole-details/sole-details.service.mjs +2 -2
  72. package/esm2022/lib/services/http/sole/sole-invoice/sole-invoice.service.mjs +12 -9
  73. package/esm2022/lib/services/http/sole/sole-invoice-template/sole-invoice-template.service.mjs +1 -2
  74. package/esm2022/lib/services/http/subscription/service-payment/service-payment.service.mjs +1 -2
  75. package/esm2022/lib/services/http/subscription/service-payment-method/service-payment-method.service.mjs +10 -27
  76. package/esm2022/lib/services/http/subscription/service-price/service-price.service.mjs +1 -2
  77. package/esm2022/lib/services/http/subscription/service-product/service-product.service.mjs +1 -2
  78. package/esm2022/lib/services/http/subscription/service-subscription/subscription.service.mjs +11 -28
  79. package/esm2022/lib/services/http/tax-review/tax-review-history/tax-review-history.service.mjs +12 -7
  80. package/esm2022/lib/services/http/tax-review/tax-review.service.mjs +11 -6
  81. package/esm2022/lib/services/http/tax-summary/tax-summary.service.mjs +3 -3
  82. package/esm2022/lib/services/http/transaction/transaction-allocation/allocation-rule/allocation-rule.service.mjs +1 -2
  83. package/esm2022/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.mjs +11 -6
  84. package/esm2022/lib/services/http/transaction/transaction.service.mjs +6 -7
  85. package/esm2022/lib/services/http/tutorial-video/tutorial-video.service.mjs +1 -1
  86. package/esm2022/lib/services/http/user/user-event-setting/user-event-setting.service.mjs +1 -2
  87. package/esm2022/lib/services/http/user/user-event-type/user-event-type.service.mjs +1 -2
  88. package/esm2022/lib/services/http/user/user.service.mjs +20 -17
  89. package/esm2022/lib/services/http/vehicle/vehicle-claim-details.service.mjs +5 -6
  90. package/esm2022/lib/services/http/vehicle/vehicle-claim.service.mjs +1 -1
  91. package/esm2022/lib/services/property/property-calculation/property-calculation.service.mjs +2 -3
  92. package/fesm2022/taxtank-core.mjs +747 -720
  93. package/fesm2022/taxtank-core.mjs.map +1 -1
  94. package/lib/collections/collection.d.ts +2 -1
  95. package/lib/collections/property/index.d.ts +1 -0
  96. package/lib/collections/property/property-category-movement.collection.d.ts +5 -1
  97. package/lib/collections/property/property-valuation.collection.d.ts +4 -0
  98. package/lib/collections/property/property.collection.d.ts +12 -16
  99. package/lib/db/Models/firm/client-movement.d.ts +2 -2
  100. package/lib/db/Models/property/property.d.ts +1 -0
  101. package/lib/db/Models/user/registration-invite.d.ts +1 -0
  102. package/lib/forms/property/index.d.ts +4 -0
  103. package/lib/forms/property/property-add.form.d.ts +16 -0
  104. package/lib/forms/property/property-category-movement-form.d.ts +6 -0
  105. package/lib/forms/property/property-forecast.form.d.ts +13 -0
  106. package/lib/forms/property/property-share.form.d.ts +8 -0
  107. package/lib/forms/property/property-valuation.form.d.ts +1 -1
  108. package/lib/models/client/client-movement.d.ts +2 -2
  109. package/lib/models/event/app-event-type.enum.d.ts +54 -56
  110. package/lib/models/property/index.d.ts +0 -1
  111. package/lib/models/property/property-category-movement.d.ts +1 -0
  112. package/lib/models/property/property-valuation.d.ts +0 -1
  113. package/lib/models/property/property.d.ts +5 -7
  114. package/lib/services/data.service.d.ts +1 -1
  115. package/lib/services/event/sse.service.d.ts +1 -1
  116. package/lib/services/http/bank/bank-account/bank-account.service.d.ts +1 -1
  117. package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +3 -11
  118. package/lib/services/http/bank/bank-transaction/bank-transaction.service.d.ts +2 -0
  119. package/lib/services/http/bank/bank.service.d.ts +0 -1
  120. package/lib/services/http/budget/budget.service.d.ts +0 -1
  121. package/lib/services/http/chart-accounts/chart-accounts-depreciations/chart-accounts-depreciations.service.d.ts +0 -1
  122. package/lib/services/http/chat/chat.service.d.ts +3 -7
  123. package/lib/services/http/chat/message-document.service.d.ts +2 -1
  124. package/lib/services/http/chat/message.service.d.ts +3 -19
  125. package/lib/services/http/client/capital-gain/annual-client-details.service.d.ts +0 -1
  126. package/lib/services/http/depreciation/depreciation.service.d.ts +2 -1
  127. package/lib/services/http/document/document.service.d.ts +0 -1
  128. package/lib/services/http/file/file.service.d.ts +0 -1
  129. package/lib/services/http/firm/client-income/client-income-types.service.d.ts +0 -1
  130. package/lib/services/http/firm/client-invite/client-invite.service.d.ts +5 -6
  131. package/lib/services/http/firm/client-movement/client-movement.service.d.ts +7 -10
  132. package/lib/services/http/holding/holding-sale.service.d.ts +0 -1
  133. package/lib/services/http/holding/holding-type.service.d.ts +0 -1
  134. package/lib/services/http/holding/holding.service.d.ts +2 -1
  135. package/lib/services/http/income-source/income-source-forecast/income-source-forecast.service.d.ts +2 -0
  136. package/lib/services/http/income-source/income-source.service.d.ts +4 -2
  137. package/lib/services/http/income-source/salary-forecast/salary-forecast.service.d.ts +4 -2
  138. package/lib/services/http/income-source/sole-forecast/sole-forecast.service.d.ts +4 -2
  139. package/lib/services/http/loan/loan.service.d.ts +2 -0
  140. package/lib/services/http/property/borrowing-report/borrowing-report.service.d.ts +0 -1
  141. package/lib/services/http/property/property-document/property-document.service.d.ts +1 -10
  142. package/lib/services/http/property/property-share/property-share.service.d.ts +2 -0
  143. package/lib/services/http/property/property-valuation/property-valuation.service.d.ts +2 -7
  144. package/lib/services/http/property/property.service.d.ts +8 -17
  145. package/lib/services/http/rest/rest-old.service.d.ts +4 -10
  146. package/lib/services/http/rest/rest.service.d.ts +7 -20
  147. package/lib/services/http/service-notification/service-notification.service.d.ts +9 -10
  148. package/lib/services/http/setup-item/setup-item.service.d.ts +1 -2
  149. package/lib/services/http/sole/bas-report/bas-report.service.d.ts +0 -1
  150. package/lib/services/http/sole/sole-business/sole-business.service.d.ts +0 -1
  151. package/lib/services/http/sole/sole-business-activity/sole-business-activity.service.d.ts +0 -1
  152. package/lib/services/http/sole/sole-business-loss/sole-business-loss-rules/sole-business-loss-offset-rule.service.d.ts +0 -1
  153. package/lib/services/http/sole/sole-business-loss/sole-business-loss.service.d.ts +3 -2
  154. package/lib/services/http/sole/sole-contact/sole-contact.service.d.ts +0 -1
  155. package/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.d.ts +3 -3
  156. package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +3 -2
  157. package/lib/services/http/sole/sole-invoice-template/sole-invoice-template.service.d.ts +0 -1
  158. package/lib/services/http/subscription/service-payment/service-payment.service.d.ts +0 -1
  159. package/lib/services/http/subscription/service-payment-method/service-payment-method.service.d.ts +4 -8
  160. package/lib/services/http/subscription/service-price/service-price.service.d.ts +0 -1
  161. package/lib/services/http/subscription/service-product/service-product.service.d.ts +0 -1
  162. package/lib/services/http/subscription/service-subscription/subscription.service.d.ts +5 -6
  163. package/lib/services/http/tax-review/tax-review-history/tax-review-history.service.d.ts +3 -1
  164. package/lib/services/http/tax-review/tax-review.service.d.ts +2 -0
  165. package/lib/services/http/tax-summary/tax-summary.service.d.ts +2 -2
  166. package/lib/services/http/transaction/transaction-allocation/allocation-rule/allocation-rule.service.d.ts +0 -1
  167. package/lib/services/http/transaction/transaction-allocation/transaction-allocation.service.d.ts +2 -0
  168. package/lib/services/http/transaction/transaction.service.d.ts +1 -3
  169. package/lib/services/http/user/user-event-setting/user-event-setting.service.d.ts +0 -1
  170. package/lib/services/http/user/user-event-type/user-event-type.service.d.ts +0 -1
  171. package/lib/services/http/user/user.service.d.ts +4 -6
  172. package/lib/services/http/vehicle/vehicle-claim-details.service.d.ts +1 -1
  173. package/lib/services/property/property-calculation/property-calculation.service.d.ts +6 -6
  174. package/package.json +1 -1
  175. package/esm2022/lib/models/property/share-filter-options.enum.mjs +0 -11
  176. package/lib/models/property/share-filter-options.enum.d.ts +0 -9
@@ -3,9 +3,9 @@ import { Injectable, Inject, inject, EventEmitter, NgModule, Pipe } from '@angul
3
3
  import * as i1$1 from '@angular/common';
4
4
  import { formatDate, CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
5
5
  import * as i1 from '@angular/common/http';
6
- import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
7
- import { map, mergeMap, filter, first as first$1, catchError, take, switchMap, finalize, debounceTime, distinctUntilChanged, startWith, delay } from 'rxjs/operators';
8
- import { ReplaySubject, Subject, Observable, throwError, combineLatest, BehaviorSubject, forkJoin, of, from, merge as merge$1 } from 'rxjs';
6
+ import { HttpParams, HttpClient, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
7
+ import { map, mergeMap, filter, catchError, first as first$1, last as last$1, take, switchMap, finalize, debounceTime, distinctUntilChanged, startWith, delay } from 'rxjs/operators';
8
+ import { ReplaySubject, Subject, BehaviorSubject, throwError, Observable, combineLatest, forkJoin, of, from, merge as merge$1 } from 'rxjs';
9
9
  import { plainToClass, Type, Transform, Exclude, Expose, classToPlain } from 'class-transformer';
10
10
  import get from 'lodash/get';
11
11
  import { __decorate } from 'tslib';
@@ -31,6 +31,7 @@ import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.j
31
31
  import { JwtHelperService } from '@auth0/angular-jwt';
32
32
  import * as mixpanel from 'mixpanel-browser';
33
33
  import clone from 'lodash/clone';
34
+ import { isArray } from 'rxjs/internal-compatibility';
34
35
  import * as i4 from '@angular/router';
35
36
  import { NavigationEnd } from '@angular/router';
36
37
  import _ from 'lodash';
@@ -200,7 +201,7 @@ class AddressService {
200
201
  getCountries() {
201
202
  if (!this._countries) {
202
203
  this.http.get(`${this.environment.apiV2}/countries`)
203
- .pipe(map((response) => response['hydra:member'].map((item) => plainToClass(Country, item))))
204
+ .pipe(map((response) => response.map((item) => plainToClass(Country, item))))
204
205
  .subscribe((countries) => {
205
206
  this._countries = countries;
206
207
  this.countriesSubject.next(countries);
@@ -549,7 +550,7 @@ let Chat$1 = class Chat extends AbstractModel {
549
550
  let ClientInvite$1 = class ClientInvite extends ObservableModel {
550
551
  };
551
552
 
552
- let ClientMovement$1 = class ClientMovement extends AbstractModel {
553
+ let ClientMovement$1 = class ClientMovement extends ObservableModel {
553
554
  };
554
555
 
555
556
  let EmployeeInvite$1 = class EmployeeInvite extends AbstractModel {
@@ -1792,6 +1793,9 @@ class Collection {
1792
1793
  get last() {
1793
1794
  return last(this.items);
1794
1795
  }
1796
+ get previous() {
1797
+ return this.items[this.items.length - 2];
1798
+ }
1795
1799
  reset() {
1796
1800
  this.index = 0;
1797
1801
  return this.items[this.index];
@@ -1848,8 +1852,11 @@ class Collection {
1848
1852
  filterByRange(path, from, to) {
1849
1853
  return this.filter((item) => get(item, path) >= from && get(item, path) <= to);
1850
1854
  }
1851
- filterByFinancialYear(path, financialYear = new FinancialYear()) {
1852
- return this.filterByRange(path, financialYear.startDate, financialYear.endDate);
1855
+ filterByFinancialYear(pathFrom, pathTo, financialYear = new FinancialYear()) {
1856
+ if (pathTo) {
1857
+ return this.filter(model => get(model, pathFrom) <= financialYear.endDate && !get(model, pathTo) || get(model, pathTo) >= financialYear.startDate);
1858
+ }
1859
+ return this.filterByRange(pathFrom, financialYear.startDate, financialYear.endDate);
1853
1860
  }
1854
1861
  find(callback) {
1855
1862
  return this.items.find(callback);
@@ -2130,13 +2137,6 @@ class PropertySaleTaxExemptionMetaFieldCollection extends Collection {
2130
2137
  }
2131
2138
 
2132
2139
  class PropertyCollection extends Collection {
2133
- /**
2134
- * Get new property collection filtered by category id
2135
- * @param id id of category for filter
2136
- */
2137
- getByCategoryId(id) {
2138
- return new PropertyCollection(this.items.filter((property) => property.category.id === id));
2139
- }
2140
2140
  /**
2141
2141
  * Get new property collection filtered by active status
2142
2142
  */
@@ -2152,12 +2152,6 @@ class PropertyCollection extends Collection {
2152
2152
  getSharedProperties() {
2153
2153
  return new PropertyCollection(this.items.filter((property) => !property.isOwn()));
2154
2154
  }
2155
- /**
2156
- * Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
2157
- */
2158
- getTaxInclusive() {
2159
- return this.create(this.items.filter((property) => property.category.isTaxInclusive));
2160
- }
2161
2155
  getUnsold() {
2162
2156
  return this.create(this.items.filter((property) => !property.isSold()));
2163
2157
  }
@@ -2173,33 +2167,21 @@ class PropertyCollection extends Collection {
2173
2167
  get marketValue() {
2174
2168
  return this.sumBy('marketValue');
2175
2169
  }
2176
- get firstForecastYear() {
2177
- return this.items.reduce((min, property) => {
2178
- const current = property.firstForecastYear;
2179
- return min > current ? current : min;
2180
- }, new FinancialYear().year);
2181
- }
2182
2170
  get marketValueGrowth() {
2183
2171
  return (this.marketValue - this.purchasePrice) / this.purchasePrice;
2184
2172
  }
2185
- /**
2186
- * list of properties
2187
- */
2188
- getCGTApplicable() {
2189
- return this.create(this.items.filter((property) => property.isCGTApplicable()));
2190
- }
2191
- getOwnerOccupiedProperties() {
2192
- return new PropertyCollection(this.items.filter((property) => property.category.isOwnerOccupied()));
2193
- }
2194
- get earliestContractDate() {
2195
- return this.items.reduce((min, property) => min < property.contractDate ? min : property.contractDate, new FinancialYear(new Date()).startDate);
2196
- }
2197
2173
  /**
2198
2174
  * Get list of unique property categories from collection
2199
2175
  */
2200
2176
  getCategories() {
2201
2177
  return uniqBy(this.items.map((property) => property.category), 'id');
2202
2178
  }
2179
+ /**
2180
+ * list of properties
2181
+ */
2182
+ getCGTApplicable() {
2183
+ return this.create(this.items.filter((property) => property.isCGTApplicable()));
2184
+ }
2203
2185
  /**
2204
2186
  * Get property with the highest growth percent
2205
2187
  */
@@ -2219,6 +2201,7 @@ class PropertyCollection extends Collection {
2219
2201
  }, this.first);
2220
2202
  }
2221
2203
  /**
2204
+ * @TODO Nicole not needed anymore?
2222
2205
  * Show best performance properties first
2223
2206
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677997/Property+Tank+Dashboard
2224
2207
  */
@@ -2239,19 +2222,50 @@ class PropertyCollection extends Collection {
2239
2222
  get netMonthlyIncome() {
2240
2223
  return this.sumBy('monthlyIncome') + this.sumBy('monthlyExpense');
2241
2224
  }
2225
+ getOwnerOccupiedProperties() {
2226
+ return new PropertyCollection(this.items.filter((property) => property.category.isOwnerOccupied()));
2227
+ }
2228
+ /**
2229
+ * Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
2230
+ */
2231
+ getTaxInclusive() {
2232
+ return this.create(this.items.filter((property) => property.category.isTaxInclusive));
2233
+ }
2234
+ groupByCategory(categories, movements, allowEmpty = false) {
2235
+ const categoryById = categories.indexBy('id');
2236
+ const movementsByCategory = movements.getCurrent().groupBy('propertyCategory.id');
2237
+ const propertiesByCategory = new Map;
2238
+ movementsByCategory.keys.forEach(key => {
2239
+ propertiesByCategory.set(categoryById.get(key), this.filterBy('id', movementsByCategory.get(key).map(movement => movement.property.id)));
2240
+ });
2241
+ if (allowEmpty) {
2242
+ categories.remove(...propertiesByCategory.keys()).toArray().forEach(category => {
2243
+ propertiesByCategory.set(category, new PropertyCollection());
2244
+ });
2245
+ }
2246
+ return propertiesByCategory;
2247
+ }
2242
2248
  }
2243
2249
 
2244
2250
  class PropertyCategoryMovementCollection extends Collection {
2245
2251
  /**
2246
2252
  * @TODO TT-2355 Alex refactor propertyForecast, use separated api (then I can remove property from param)
2247
2253
  */
2248
- getByForecast(property, forecast) {
2249
- const financialYear = new FinancialYear(forecast.financialYear);
2250
- return this.filterBy('property.id', property.id).filter((movement) => movement.fromDate <= financialYear.endDate && !movement.toDate || movement.toDate >= financialYear.startDate);
2254
+ filterByForecast(property, forecast) {
2255
+ return this.filterBy('property.id', property.id)
2256
+ .filterByFinancialYear('fromDate', 'toDate', new FinancialYear(forecast.financialYear));
2251
2257
  }
2252
2258
  hasCategory(categoryId) {
2253
2259
  return !!this.findBy('propertyCategory.id', categoryId);
2254
2260
  }
2261
+ /**
2262
+ * active movement by property based on selected year
2263
+ */
2264
+ getCurrent() {
2265
+ return this.create(this.filterByFinancialYear('fromDate', 'toDate')
2266
+ .indexBy('property.id')
2267
+ .toArray());
2268
+ }
2255
2269
  }
2256
2270
 
2257
2271
  class PropertyShareCollection extends Collection {
@@ -2273,6 +2287,9 @@ class PropertyShareCollection extends Collection {
2273
2287
  }
2274
2288
  }
2275
2289
 
2290
+ class PropertyValuationCollection extends Collection {
2291
+ }
2292
+
2276
2293
  /**
2277
2294
  * Enum with symbols based on depreciation LVP asset type
2278
2295
  */
@@ -4479,6 +4496,105 @@ __decorate([
4479
4496
  Expose()
4480
4497
  ], ServiceSubscription.prototype, "promoCodeId", null);
4481
4498
 
4499
+ class ServicePayment extends ServicePayment$1 {
4500
+ static { this.daysToInvoiceUrlExpired = 30; }
4501
+ /**
4502
+ * Stripe stores actual links to payment invoices for 30 days.
4503
+ * Link expires after 30 days
4504
+ */
4505
+ isInvoiceLinkExpired() {
4506
+ const expirationDate = new Date(this.date.setDate(this.date.getDate() + ServicePayment.daysToInvoiceUrlExpired));
4507
+ return expirationDate.getTime() < new Date().getTime();
4508
+ }
4509
+ }
4510
+ __decorate([
4511
+ Type(() => ServiceSubscription)
4512
+ ], ServicePayment.prototype, "subscription", void 0);
4513
+ __decorate([
4514
+ Type(() => Date)
4515
+ ], ServicePayment.prototype, "date", void 0);
4516
+
4517
+ let ServicePaymentMethod$1 = class ServicePaymentMethod extends AbstractModel {
4518
+ };
4519
+
4520
+ var PaymentMethodBrandEnum;
4521
+ (function (PaymentMethodBrandEnum) {
4522
+ PaymentMethodBrandEnum["UNKNOWN"] = "Unknown";
4523
+ PaymentMethodBrandEnum["AMEX"] = "American Express";
4524
+ PaymentMethodBrandEnum["DINERS"] = "Diners Club";
4525
+ PaymentMethodBrandEnum["DISCOVER"] = "Discover";
4526
+ PaymentMethodBrandEnum["JCB"] = "JCB";
4527
+ PaymentMethodBrandEnum["MASTERCARD"] = "Mastercard";
4528
+ PaymentMethodBrandEnum["UNIONPAY"] = "UnionPay";
4529
+ PaymentMethodBrandEnum["VISA"] = "Visa";
4530
+ })(PaymentMethodBrandEnum || (PaymentMethodBrandEnum = {}));
4531
+
4532
+ var ServicePaymentMethodCardBrandEnum;
4533
+ (function (ServicePaymentMethodCardBrandEnum) {
4534
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["UNKNOWN"] = 0] = "UNKNOWN";
4535
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["AMEX"] = 1] = "AMEX";
4536
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["DINERS"] = 2] = "DINERS";
4537
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["DISCOVER"] = 3] = "DISCOVER";
4538
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["JCB"] = 4] = "JCB";
4539
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["MASTERCARD"] = 5] = "MASTERCARD";
4540
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["UNIONPAY"] = 6] = "UNIONPAY";
4541
+ ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["VISA"] = 7] = "VISA";
4542
+ })(ServicePaymentMethodCardBrandEnum || (ServicePaymentMethodCardBrandEnum = {}));
4543
+
4544
+ var ServicePaymentMethodTypeEnum;
4545
+ (function (ServicePaymentMethodTypeEnum) {
4546
+ ServicePaymentMethodTypeEnum[ServicePaymentMethodTypeEnum["AU_BECS_DEBIT"] = 1] = "AU_BECS_DEBIT";
4547
+ ServicePaymentMethodTypeEnum[ServicePaymentMethodTypeEnum["CARD"] = 2] = "CARD";
4548
+ })(ServicePaymentMethodTypeEnum || (ServicePaymentMethodTypeEnum = {}));
4549
+
4550
+ class ServicePaymentMethod extends ServicePaymentMethod$1 {
4551
+ get logo() {
4552
+ if (!this.isCard()) {
4553
+ return null;
4554
+ }
4555
+ return `/assets/img/payment-methods/${this.cardBrand}.svg`;
4556
+ }
4557
+ get brandName() {
4558
+ return this.isCard() ? PaymentMethodBrandEnum[ServicePaymentMethodCardBrandEnum[this.cardBrand]] : 'BECS Direct Debit (AU)';
4559
+ }
4560
+ /**
4561
+ * Get expiration date formatted string (MM/YY)
4562
+ */
4563
+ get expirationDate() {
4564
+ if (!this.isCard()) {
4565
+ return null;
4566
+ }
4567
+ return `${('0' + this.cardExpirationMonth).slice(-2)}/${this.cardExpirationYear.toString().slice(-2)}`;
4568
+ }
4569
+ get description() {
4570
+ return `${this.brandName} ***${this.lastFourDigits}`;
4571
+ }
4572
+ isCard() {
4573
+ return this.type === ServicePaymentMethodTypeEnum.CARD;
4574
+ }
4575
+ }
4576
+
4577
+ /**
4578
+ * Enum with icon-names related to tank roles
4579
+ */
4580
+ var ServiceProductIconsEnum;
4581
+ (function (ServiceProductIconsEnum) {
4582
+ ServiceProductIconsEnum["ROLE_USER_WORK"] = "icon-case";
4583
+ ServiceProductIconsEnum["ROLE_USER_PROPERTY"] = "icon-property";
4584
+ ServiceProductIconsEnum["ROLE_USER_SOLE"] = "icon-sole-tank";
4585
+ ServiceProductIconsEnum["ROLE_USER_HOLDING"] = "icon-holding-tank";
4586
+ })(ServiceProductIconsEnum || (ServiceProductIconsEnum = {}));
4587
+
4588
+ /**
4589
+ * List of user roles related to tanks (subscription products)
4590
+ */
4591
+ const SERVICE_PRODUCT_ROLES = [
4592
+ UserRolesEnum.WORK_TANK,
4593
+ UserRolesEnum.PROPERTY_TANK,
4594
+ UserRolesEnum.SOLE_TANK,
4595
+ UserRolesEnum.HOLDING_TANK
4596
+ ];
4597
+
4482
4598
  class ClientMovement extends ClientMovement$1 {
4483
4599
  }
4484
4600
  __decorate([
@@ -4582,105 +4698,6 @@ __decorate([
4582
4698
  Type(() => Firm)
4583
4699
  ], EmployeeDetails.prototype, "firm", void 0);
4584
4700
 
4585
- class ServicePayment extends ServicePayment$1 {
4586
- static { this.daysToInvoiceUrlExpired = 30; }
4587
- /**
4588
- * Stripe stores actual links to payment invoices for 30 days.
4589
- * Link expires after 30 days
4590
- */
4591
- isInvoiceLinkExpired() {
4592
- const expirationDate = new Date(this.date.setDate(this.date.getDate() + ServicePayment.daysToInvoiceUrlExpired));
4593
- return expirationDate.getTime() < new Date().getTime();
4594
- }
4595
- }
4596
- __decorate([
4597
- Type(() => ServiceSubscription)
4598
- ], ServicePayment.prototype, "subscription", void 0);
4599
- __decorate([
4600
- Type(() => Date)
4601
- ], ServicePayment.prototype, "date", void 0);
4602
-
4603
- let ServicePaymentMethod$1 = class ServicePaymentMethod extends AbstractModel {
4604
- };
4605
-
4606
- var PaymentMethodBrandEnum;
4607
- (function (PaymentMethodBrandEnum) {
4608
- PaymentMethodBrandEnum["UNKNOWN"] = "Unknown";
4609
- PaymentMethodBrandEnum["AMEX"] = "American Express";
4610
- PaymentMethodBrandEnum["DINERS"] = "Diners Club";
4611
- PaymentMethodBrandEnum["DISCOVER"] = "Discover";
4612
- PaymentMethodBrandEnum["JCB"] = "JCB";
4613
- PaymentMethodBrandEnum["MASTERCARD"] = "Mastercard";
4614
- PaymentMethodBrandEnum["UNIONPAY"] = "UnionPay";
4615
- PaymentMethodBrandEnum["VISA"] = "Visa";
4616
- })(PaymentMethodBrandEnum || (PaymentMethodBrandEnum = {}));
4617
-
4618
- var ServicePaymentMethodCardBrandEnum;
4619
- (function (ServicePaymentMethodCardBrandEnum) {
4620
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["UNKNOWN"] = 0] = "UNKNOWN";
4621
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["AMEX"] = 1] = "AMEX";
4622
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["DINERS"] = 2] = "DINERS";
4623
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["DISCOVER"] = 3] = "DISCOVER";
4624
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["JCB"] = 4] = "JCB";
4625
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["MASTERCARD"] = 5] = "MASTERCARD";
4626
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["UNIONPAY"] = 6] = "UNIONPAY";
4627
- ServicePaymentMethodCardBrandEnum[ServicePaymentMethodCardBrandEnum["VISA"] = 7] = "VISA";
4628
- })(ServicePaymentMethodCardBrandEnum || (ServicePaymentMethodCardBrandEnum = {}));
4629
-
4630
- var ServicePaymentMethodTypeEnum;
4631
- (function (ServicePaymentMethodTypeEnum) {
4632
- ServicePaymentMethodTypeEnum[ServicePaymentMethodTypeEnum["AU_BECS_DEBIT"] = 1] = "AU_BECS_DEBIT";
4633
- ServicePaymentMethodTypeEnum[ServicePaymentMethodTypeEnum["CARD"] = 2] = "CARD";
4634
- })(ServicePaymentMethodTypeEnum || (ServicePaymentMethodTypeEnum = {}));
4635
-
4636
- class ServicePaymentMethod extends ServicePaymentMethod$1 {
4637
- get logo() {
4638
- if (!this.isCard()) {
4639
- return null;
4640
- }
4641
- return `/assets/img/payment-methods/${this.cardBrand}.svg`;
4642
- }
4643
- get brandName() {
4644
- return this.isCard() ? PaymentMethodBrandEnum[ServicePaymentMethodCardBrandEnum[this.cardBrand]] : 'BECS Direct Debit (AU)';
4645
- }
4646
- /**
4647
- * Get expiration date formatted string (MM/YY)
4648
- */
4649
- get expirationDate() {
4650
- if (!this.isCard()) {
4651
- return null;
4652
- }
4653
- return `${('0' + this.cardExpirationMonth).slice(-2)}/${this.cardExpirationYear.toString().slice(-2)}`;
4654
- }
4655
- get description() {
4656
- return `${this.brandName} ***${this.lastFourDigits}`;
4657
- }
4658
- isCard() {
4659
- return this.type === ServicePaymentMethodTypeEnum.CARD;
4660
- }
4661
- }
4662
-
4663
- /**
4664
- * Enum with icon-names related to tank roles
4665
- */
4666
- var ServiceProductIconsEnum;
4667
- (function (ServiceProductIconsEnum) {
4668
- ServiceProductIconsEnum["ROLE_USER_WORK"] = "icon-case";
4669
- ServiceProductIconsEnum["ROLE_USER_PROPERTY"] = "icon-property";
4670
- ServiceProductIconsEnum["ROLE_USER_SOLE"] = "icon-sole-tank";
4671
- ServiceProductIconsEnum["ROLE_USER_HOLDING"] = "icon-holding-tank";
4672
- })(ServiceProductIconsEnum || (ServiceProductIconsEnum = {}));
4673
-
4674
- /**
4675
- * List of user roles related to tanks (subscription products)
4676
- */
4677
- const SERVICE_PRODUCT_ROLES = [
4678
- UserRolesEnum.WORK_TANK,
4679
- UserRolesEnum.PROPERTY_TANK,
4680
- UserRolesEnum.SOLE_TANK,
4681
- UserRolesEnum.HOLDING_TANK
4682
- ];
4683
-
4684
4701
  class SoleBusinessAllocation extends SoleBusinessAllocation$1 {
4685
4702
  }
4686
4703
  __decorate([
@@ -5528,9 +5545,6 @@ __decorate([
5528
5545
  __decorate([
5529
5546
  Type(() => PropertyDocument)
5530
5547
  ], PropertyValuation.prototype, "document", void 0);
5531
- __decorate([
5532
- Type(() => Number)
5533
- ], PropertyValuation.prototype, "marketValue", void 0);
5534
5548
 
5535
5549
  class PropertyForecast extends PropertyForecast$1 {
5536
5550
  constructor() {
@@ -5604,6 +5618,9 @@ __decorate([
5604
5618
  __decorate([
5605
5619
  Type(() => PropertyCategory)
5606
5620
  ], PropertyCategoryMovement.prototype, "propertyCategory", void 0);
5621
+ __decorate([
5622
+ Type(() => Property)
5623
+ ], PropertyCategoryMovement.prototype, "property", void 0);
5607
5624
  __decorate([
5608
5625
  Type(() => Date)
5609
5626
  ], PropertyCategoryMovement.prototype, "fromDate", void 0);
@@ -5635,11 +5652,8 @@ class Property extends Property$1 {
5635
5652
  get capitalCostsTotalAmount() {
5636
5653
  return this.stampDuty + this.legalFees + this.otherCapitalCosts;
5637
5654
  }
5638
- get currentYearValuations() {
5639
- return this.valuations.filter((valuation) => valuation.isCurrentYear());
5640
- }
5641
5655
  get marketValue() {
5642
- return this.actualValuation?.marketValue || 0;
5656
+ return this.valuation?.marketValue || 0;
5643
5657
  }
5644
5658
  get currentYearForecast() {
5645
5659
  return this.forecasts.find((forecast) => forecast.isCurrentYear());
@@ -5653,18 +5667,12 @@ class Property extends Property$1 {
5653
5667
  get forecastedCashPosition() {
5654
5668
  return this.currentYearForecast?.cashPosition || 0;
5655
5669
  }
5656
- get firstForecastYear() {
5657
- return this.forecasts.reduce((min, forecast) => min > forecast.financialYear ? forecast.financialYear : min, new FinancialYear().year);
5658
- }
5659
5670
  get marketValueGrowth() {
5660
5671
  return (this.marketValue - this.purchasePrice) / this.marketValue;
5661
5672
  }
5662
5673
  get myShare() {
5663
5674
  return this.shares.find((share) => share.user.id === +localStorage.getItem('userId'));
5664
5675
  }
5665
- get actualValuation() {
5666
- return this.valuations.reduce((maxDateValuation, valuation) => maxDateValuation.date > valuation.date ? maxDateValuation : valuation, this.valuations[0]);
5667
- }
5668
5676
  get claimPercent() {
5669
5677
  return this.currentYearForecast.claimPercent;
5670
5678
  }
@@ -5677,14 +5685,6 @@ class Property extends Property$1 {
5677
5685
  get shareRatio() {
5678
5686
  return this.myShare.percent / 100;
5679
5687
  }
5680
- get previousCategory() {
5681
- let previousCategory;
5682
- const movementsCount = this.categoryMovements.length;
5683
- if (movementsCount > 1) {
5684
- previousCategory = this.categoryMovements[movementsCount - 2].propertyCategory;
5685
- }
5686
- return previousCategory;
5687
- }
5688
5688
  getCurrentSubscription() {
5689
5689
  // always return first element because subscriptions array contains only one element
5690
5690
  return this.subscriptions[0];
@@ -5828,6 +5828,9 @@ __decorate([
5828
5828
  __decorate([
5829
5829
  Type(() => PropertyCategory)
5830
5830
  ], Property.prototype, "category", void 0);
5831
+ __decorate([
5832
+ Type(() => PropertyCategoryMovement)
5833
+ ], Property.prototype, "categoryMovements", void 0);
5831
5834
  __decorate([
5832
5835
  Type(() => Number)
5833
5836
  ], Property.prototype, "stampDuty", void 0);
@@ -5837,15 +5840,18 @@ __decorate([
5837
5840
  __decorate([
5838
5841
  Type(() => Number)
5839
5842
  ], Property.prototype, "otherCapitalCosts", void 0);
5840
- __decorate([
5841
- Type(() => PropertyValuation)
5842
- ], Property.prototype, "valuations", void 0);
5843
5843
  __decorate([
5844
5844
  Type(() => PropertyForecast)
5845
5845
  ], Property.prototype, "forecasts", void 0);
5846
5846
  __decorate([
5847
- Type(() => PropertyCategoryMovement)
5848
- ], Property.prototype, "categoryMovements", void 0);
5847
+ Type(() => PropertyShare$1)
5848
+ ], Property.prototype, "shares", void 0);
5849
+ __decorate([
5850
+ Type(() => PropertyValuation)
5851
+ ], Property.prototype, "valuations", void 0);
5852
+ __decorate([
5853
+ Type(() => PropertyValuation)
5854
+ ], Property.prototype, "valuation", void 0);
5849
5855
  __decorate([
5850
5856
  Type(() => User)
5851
5857
  ], Property.prototype, "user", void 0);
@@ -6239,17 +6245,6 @@ __decorate([
6239
6245
  Type(() => User)
6240
6246
  ], BorrowingReport.prototype, "user", void 0);
6241
6247
 
6242
- /**
6243
- * @TODO used only on dashboard, move from tt-core
6244
- * Enum with properties ownership filter options
6245
- */
6246
- var ShareFilterOptionsEnum;
6247
- (function (ShareFilterOptionsEnum) {
6248
- ShareFilterOptionsEnum[ShareFilterOptionsEnum["ALL"] = 1] = "ALL";
6249
- ShareFilterOptionsEnum[ShareFilterOptionsEnum["CREATED"] = 2] = "CREATED";
6250
- ShareFilterOptionsEnum[ShareFilterOptionsEnum["SHARED"] = 3] = "SHARED";
6251
- })(ShareFilterOptionsEnum || (ShareFilterOptionsEnum = {}));
6252
-
6253
6248
  class TransactionMetaField extends TransactionMetaField$1 {
6254
6249
  }
6255
6250
  __decorate([
@@ -9975,62 +9970,60 @@ var AppEventTypeEnum;
9975
9970
  AppEventTypeEnum[AppEventTypeEnum["BANK_TRANSACTION_ALLOCATED"] = 2] = "BANK_TRANSACTION_ALLOCATED";
9976
9971
  AppEventTypeEnum[AppEventTypeEnum["BANK_TRANSACTIONS_ADDED"] = 3] = "BANK_TRANSACTIONS_ADDED";
9977
9972
  AppEventTypeEnum[AppEventTypeEnum["BANK_TRANSACTIONS_DELETED"] = 4] = "BANK_TRANSACTIONS_DELETED";
9978
- AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONSENT_UPDATED"] = 5] = "BASIQ_CONSENT_UPDATED";
9979
- AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONNECTION_UPDATED"] = 6] = "BASIQ_CONNECTION_UPDATED";
9980
- AppEventTypeEnum[AppEventTypeEnum["BASIQ_JOB_CREATED"] = 7] = "BASIQ_JOB_CREATED";
9981
- AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_SUCCESS"] = 8] = "BASIQ_LOGIN_SUCCESS";
9982
- AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_FAILED"] = 9] = "BASIQ_LOGIN_FAILED";
9983
- AppEventTypeEnum[AppEventTypeEnum["BASIQ_ACCOUNTS_RETRIEVED"] = 10] = "BASIQ_ACCOUNTS_RETRIEVED";
9984
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 11] = "CLIENT_INVITE_ACCEPTED";
9985
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 12] = "CLIENT_OPEN_CHAT";
9986
- AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 13] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
9987
- AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 14] = "CURRENT_USER_GET_FAILED";
9988
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 15] = "DEPRECIATION_DELETED";
9989
- AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 16] = "DEPRECIATIONS_CREATED";
9990
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 17] = "INCOME_SOURCES_CREATED";
9991
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 18] = "INCOME_SOURCES_UPDATED";
9992
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 19] = "INCOME_SOURCES_FORECASTS_CREATED";
9993
- AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 20] = "INCOME_SOURCES_FORECASTS_UPDATED";
9994
- AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 21] = "LOAN_UPDATED";
9995
- AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 22] = "LOAN_PAYOUT_UPDATED";
9996
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 23] = "MESSAGE_CREATED";
9997
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 24] = "MESSAGE_FILE_CREATED";
9998
- AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 25] = "MESSAGE_FILE_DELETED";
9999
- AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 26] = "NOTIFICATION_ADDED";
10000
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 27] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
10001
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 28] = "PROPERTY_UPDATED";
10002
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 29] = "PROPERTY_UPDATED_WITH_DOCUMENT";
10003
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 30] = "PROPERTY_DOCUMENT_ADDED";
10004
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 31] = "PROPERTY_MOVEMENT_CREATED";
10005
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 32] = "PROPERTY_MOVEMENT_UPDATED";
10006
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 33] = "PROPERTY_MOVEMENT_DELETED";
10007
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 34] = "PROPERTY_SHARE_UPDATED";
10008
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 35] = "PROPERTY_SALE_ADDED";
10009
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 36] = "PROPERTY_SALE_DELETED";
10010
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 37] = "PROPERTY_SUBSCRIPTION_ADDED";
10011
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 38] = "PROPERTY_SUBSCRIPTION_DELETED";
10012
- AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 39] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
10013
- AppEventTypeEnum[AppEventTypeEnum["SERVICE_SUBSCRIPTION_UPDATED"] = 40] = "SERVICE_SUBSCRIPTION_UPDATED";
10014
- AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 41] = "SOLE_BUSINESS_CREATED";
10015
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 42] = "SOLE_DEPRECIATION_METHOD_UPDATED";
10016
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 43] = "SOLE_DETAILS_CREATED";
10017
- AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 44] = "SOLE_DETAILS_UPDATED";
10018
- AppEventTypeEnum[AppEventTypeEnum["SOLE_INVOICE_PUBLISHED"] = 45] = "SOLE_INVOICE_PUBLISHED";
10019
- AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 46] = "TAX_REVIEW_UPDATED";
10020
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_ALLOCATION_CREATED"] = 47] = "TRANSACTION_ALLOCATION_CREATED";
10021
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_ALLOCATION_DELETED"] = 48] = "TRANSACTION_ALLOCATION_DELETED";
10022
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 49] = "TRANSACTION_CREATED";
10023
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 50] = "TRANSACTION_DELETED";
10024
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 51] = "TRANSACTION_UPDATED";
10025
- AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 52] = "TRANSACTIONS_CREATED";
10026
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 53] = "VEHICLE_CLAIM_UPDATED";
10027
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 54] = "VEHICLE_CLAIM_CREATED";
10028
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 55] = "VEHICLE_CLAIM_DETAILS_UPDATED";
10029
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 56] = "VEHICLE_CLAIM_DETAILS_CREATED";
10030
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 57] = "VEHICLE_LOGBOOK_CREATED";
10031
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 58] = "VEHICLE_LOGBOOK_UPDATED";
10032
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 59] = "VEHICLE_LOGBOOK_DELETED";
10033
- AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 60] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
9973
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_CONNECTION_UPDATED"] = 5] = "BASIQ_CONNECTION_UPDATED";
9974
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_JOB_CREATED"] = 6] = "BASIQ_JOB_CREATED";
9975
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_SUCCESS"] = 7] = "BASIQ_LOGIN_SUCCESS";
9976
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_LOGIN_FAILED"] = 8] = "BASIQ_LOGIN_FAILED";
9977
+ AppEventTypeEnum[AppEventTypeEnum["BASIQ_ACCOUNTS_RETRIEVED"] = 9] = "BASIQ_ACCOUNTS_RETRIEVED";
9978
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_INVITE_ACCEPTED"] = 10] = "CLIENT_INVITE_ACCEPTED";
9979
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_OPEN_CHAT"] = 11] = "CLIENT_OPEN_CHAT";
9980
+ AppEventTypeEnum[AppEventTypeEnum["CLIENT_TRANSFER_TO_OTHER_EMPLOYEE"] = 12] = "CLIENT_TRANSFER_TO_OTHER_EMPLOYEE";
9981
+ AppEventTypeEnum[AppEventTypeEnum["CURRENT_USER_GET_FAILED"] = 13] = "CURRENT_USER_GET_FAILED";
9982
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATION_DELETED"] = 14] = "DEPRECIATION_DELETED";
9983
+ AppEventTypeEnum[AppEventTypeEnum["DEPRECIATIONS_CREATED"] = 15] = "DEPRECIATIONS_CREATED";
9984
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_CREATED"] = 16] = "INCOME_SOURCES_CREATED";
9985
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_UPDATED"] = 17] = "INCOME_SOURCES_UPDATED";
9986
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_CREATED"] = 18] = "INCOME_SOURCES_FORECASTS_CREATED";
9987
+ AppEventTypeEnum[AppEventTypeEnum["INCOME_SOURCES_FORECASTS_UPDATED"] = 19] = "INCOME_SOURCES_FORECASTS_UPDATED";
9988
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_UPDATED"] = 20] = "LOAN_UPDATED";
9989
+ AppEventTypeEnum[AppEventTypeEnum["LOAN_PAYOUT_UPDATED"] = 21] = "LOAN_PAYOUT_UPDATED";
9990
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_CREATED"] = 22] = "MESSAGE_CREATED";
9991
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_CREATED"] = 23] = "MESSAGE_FILE_CREATED";
9992
+ AppEventTypeEnum[AppEventTypeEnum["MESSAGE_FILE_DELETED"] = 24] = "MESSAGE_FILE_DELETED";
9993
+ AppEventTypeEnum[AppEventTypeEnum["NOTIFICATION_ADDED"] = 25] = "NOTIFICATION_ADDED";
9994
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DEPRECIATION_CALCULATION_UPDATED"] = 26] = "PROPERTY_DEPRECIATION_CALCULATION_UPDATED";
9995
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED"] = 27] = "PROPERTY_UPDATED";
9996
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_UPDATED_WITH_DOCUMENT"] = 28] = "PROPERTY_UPDATED_WITH_DOCUMENT";
9997
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_DOCUMENT_ADDED"] = 29] = "PROPERTY_DOCUMENT_ADDED";
9998
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_CREATED"] = 30] = "PROPERTY_MOVEMENT_CREATED";
9999
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_UPDATED"] = 31] = "PROPERTY_MOVEMENT_UPDATED";
10000
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_MOVEMENT_DELETED"] = 32] = "PROPERTY_MOVEMENT_DELETED";
10001
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SHARE_UPDATED"] = 33] = "PROPERTY_SHARE_UPDATED";
10002
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_ADDED"] = 34] = "PROPERTY_SALE_ADDED";
10003
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SALE_DELETED"] = 35] = "PROPERTY_SALE_DELETED";
10004
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_ADDED"] = 36] = "PROPERTY_SUBSCRIPTION_ADDED";
10005
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_SUBSCRIPTION_DELETED"] = 37] = "PROPERTY_SUBSCRIPTION_DELETED";
10006
+ AppEventTypeEnum[AppEventTypeEnum["PROPERTY_VALUATION_DOCUMENT_CREATED"] = 38] = "PROPERTY_VALUATION_DOCUMENT_CREATED";
10007
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_BUSINESS_CREATED"] = 39] = "SOLE_BUSINESS_CREATED";
10008
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DEPRECIATION_METHOD_UPDATED"] = 40] = "SOLE_DEPRECIATION_METHOD_UPDATED";
10009
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_CREATED"] = 41] = "SOLE_DETAILS_CREATED";
10010
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_DETAILS_UPDATED"] = 42] = "SOLE_DETAILS_UPDATED";
10011
+ AppEventTypeEnum[AppEventTypeEnum["SOLE_INVOICE_PUBLISHED"] = 43] = "SOLE_INVOICE_PUBLISHED";
10012
+ AppEventTypeEnum[AppEventTypeEnum["TAX_REVIEW_UPDATED"] = 44] = "TAX_REVIEW_UPDATED";
10013
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_ALLOCATION_CREATED"] = 45] = "TRANSACTION_ALLOCATION_CREATED";
10014
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_ALLOCATION_DELETED"] = 46] = "TRANSACTION_ALLOCATION_DELETED";
10015
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_CREATED"] = 47] = "TRANSACTION_CREATED";
10016
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_DELETED"] = 48] = "TRANSACTION_DELETED";
10017
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTION_UPDATED"] = 49] = "TRANSACTION_UPDATED";
10018
+ AppEventTypeEnum[AppEventTypeEnum["TRANSACTIONS_CREATED"] = 50] = "TRANSACTIONS_CREATED";
10019
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_UPDATED"] = 51] = "VEHICLE_CLAIM_UPDATED";
10020
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 52] = "VEHICLE_CLAIM_CREATED";
10021
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_UPDATED"] = 53] = "VEHICLE_CLAIM_DETAILS_UPDATED";
10022
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_DETAILS_CREATED"] = 54] = "VEHICLE_CLAIM_DETAILS_CREATED";
10023
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_CREATED"] = 55] = "VEHICLE_LOGBOOK_CREATED";
10024
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_UPDATED"] = 56] = "VEHICLE_LOGBOOK_UPDATED";
10025
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 57] = "VEHICLE_LOGBOOK_DELETED";
10026
+ AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED"] = 58] = "VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED";
10034
10027
  })(AppEventTypeEnum || (AppEventTypeEnum = {}));
10035
10028
 
10036
10029
  /**
@@ -10541,6 +10534,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10541
10534
  }]
10542
10535
  }] });
10543
10536
 
10537
+ class AuthService {
10538
+ constructor(http, jwtService, mpService, environment) {
10539
+ this.http = http;
10540
+ this.jwtService = jwtService;
10541
+ this.mpService = mpService;
10542
+ this.environment = environment;
10543
+ this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
10544
+ }
10545
+ setAuth(response) {
10546
+ this.jwtService.saveTokens(response);
10547
+ this.isLoggedInSubject.next(true);
10548
+ }
10549
+ login(username, password) {
10550
+ return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(map((response) => {
10551
+ this.setAuth(response);
10552
+ this.mpService.track('login');
10553
+ return response;
10554
+ }), catchError((error) => {
10555
+ this.mpService.track('loginError', { username });
10556
+ return throwError(error);
10557
+ }));
10558
+ }
10559
+ refresh(refreshToken) {
10560
+ return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
10561
+ this.setAuth(response);
10562
+ return response;
10563
+ }));
10564
+ }
10565
+ logoutFront(url = '/login') {
10566
+ localStorage.clear();
10567
+ this.mpService.track('logout');
10568
+ this.mpService.reset();
10569
+ location.replace(url);
10570
+ }
10571
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: MixpanelService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
10572
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, providedIn: 'root' }); }
10573
+ }
10574
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, decorators: [{
10575
+ type: Injectable,
10576
+ args: [{
10577
+ providedIn: 'root'
10578
+ }]
10579
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: MixpanelService }, { type: undefined, decorators: [{
10580
+ type: Inject,
10581
+ args: ['environment']
10582
+ }] }]; } });
10583
+
10544
10584
  /**
10545
10585
  * server sent events service
10546
10586
  * https://symfony.com/doc/current/mercure.html
@@ -10638,8 +10678,7 @@ class DataService {
10638
10678
  * @param model Single object or array from which will be created model instance(s)
10639
10679
  */
10640
10680
  createModelInstance(model) {
10641
- // excludePrefixes - class-transformer option is using to ignore hydra fields
10642
- return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
10681
+ return plainToClass(this.modelClass, model);
10643
10682
  }
10644
10683
  createCollectionInstance(collectionClass, items) {
10645
10684
  return new collectionClass(items);
@@ -10751,10 +10790,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10751
10790
  * CollectionModel - entity collection class
10752
10791
  */
10753
10792
  let RestService$1 = class RestService extends DataService {
10754
- constructor(http, eventDispatcherService, environment) {
10793
+ constructor(environment) {
10755
10794
  super();
10756
- this.http = http;
10757
- this.eventDispatcherService = eventDispatcherService;
10758
10795
  this.environment = environment;
10759
10796
  /**
10760
10797
  * Subject for service cache
@@ -10769,15 +10806,9 @@ let RestService$1 = class RestService extends DataService {
10769
10806
  this.mpService = inject(MixpanelService);
10770
10807
  this.sseService = inject(SseService);
10771
10808
  this.toastService = inject(ToastService);
10809
+ this.http = inject(HttpClient);
10810
+ this.eventDispatcherService = inject(EventDispatcherService);
10772
10811
  this.roles = [];
10773
- /**
10774
- * disable cache update by requests, update only by SSE events
10775
- */
10776
- this.disableCache = false;
10777
- // @TODO Alex remove, bad idea to call empty method overrided in child (because it will be called with parent context)
10778
- this.listenEvents();
10779
- // @TODO Alex remove, bad idea to call empty method overrided in child (because it will be called with parent context)
10780
- this.listenSSE();
10781
10812
  }
10782
10813
  get apiUrl() {
10783
10814
  return `${this.environment.apiV2}/${this.endpointUri}`;
@@ -10807,7 +10838,7 @@ let RestService$1 = class RestService extends DataService {
10807
10838
  // Set cache as empty collection to avoid multiple requests before cache filled
10808
10839
  this.setCache([]);
10809
10840
  return this.http.get(path)
10810
- .pipe(map((response) => this.isApiPlatform ? response['hydra:member'] : toArray(response)), map((response) => {
10841
+ .pipe(map((response) => isArray(response) ? response : toArray(response)), map((response) => {
10811
10842
  this.setCache(response, true);
10812
10843
  return this.cache;
10813
10844
  }));
@@ -10836,7 +10867,9 @@ let RestService$1 = class RestService extends DataService {
10836
10867
  return this.http.post(path, classToPlain(model))
10837
10868
  .pipe(map((response) => {
10838
10869
  const result = this.createModelInstance(response);
10839
- this.handleResponse([result], 'post', mpData);
10870
+ if (!this.mercureTopic) {
10871
+ this.handleResponse([result], 'post', mpData);
10872
+ }
10840
10873
  return result;
10841
10874
  }), catchError((error) => {
10842
10875
  this.handleResponseError([model], 'post', mpData);
@@ -10851,7 +10884,9 @@ let RestService$1 = class RestService extends DataService {
10851
10884
  return this.http.post(this.apiUrl, classToPlain(models))
10852
10885
  .pipe(map((response) => {
10853
10886
  const result = response.map((item) => this.createModelInstance(item));
10854
- this.handleResponse(result, 'post');
10887
+ if (!this.mercureTopic) {
10888
+ this.handleResponse(result, 'post');
10889
+ }
10855
10890
  return result;
10856
10891
  }), catchError((error) => {
10857
10892
  this.handleResponseError(models, 'post');
@@ -10866,7 +10901,9 @@ let RestService$1 = class RestService extends DataService {
10866
10901
  return this.http.put(path, classToPlain(model))
10867
10902
  .pipe(map((response) => {
10868
10903
  const result = this.createModelInstance(response);
10869
- this.handleResponse([result], 'put', mpData);
10904
+ if (!this.mercureTopic) {
10905
+ this.handleResponse([result], 'put', mpData);
10906
+ }
10870
10907
  return result;
10871
10908
  }), catchError((error) => {
10872
10909
  this.handleResponseError([model], 'put', mpData);
@@ -10881,7 +10918,9 @@ let RestService$1 = class RestService extends DataService {
10881
10918
  return this.http.put(this.apiUrl, classToPlain(models))
10882
10919
  .pipe(map((response) => {
10883
10920
  const result = response.map((item) => this.createModelInstance(item));
10884
- this.handleResponse(result, 'put');
10921
+ if (!this.mercureTopic) {
10922
+ this.handleResponse(result, 'put');
10923
+ }
10885
10924
  return result;
10886
10925
  }), catchError((error) => {
10887
10926
  this.handleResponseError(models, 'put');
@@ -10895,7 +10934,9 @@ let RestService$1 = class RestService extends DataService {
10895
10934
  this.handleAccessError('delete');
10896
10935
  return this.http.delete(`${this.apiUrl}/${model.id}`)
10897
10936
  .pipe(map(() => {
10898
- this.handleResponse([model], 'delete', mpData);
10937
+ if (!this.mercureTopic) {
10938
+ this.handleResponse([model], 'delete', mpData);
10939
+ }
10899
10940
  }), catchError((error) => {
10900
10941
  this.handleResponseError([model], 'delete', mpData);
10901
10942
  return throwError(error);
@@ -10908,7 +10949,9 @@ let RestService$1 = class RestService extends DataService {
10908
10949
  this.handleAccessError('deleteBatch');
10909
10950
  return this.http.post(`${this.apiUrl}/delete`, classToPlain(models))
10910
10951
  .pipe(map(() => {
10911
- this.handleResponse(models, 'delete');
10952
+ if (!this.mercureTopic) {
10953
+ this.handleResponse(models, 'delete');
10954
+ }
10912
10955
  }), catchError((error) => {
10913
10956
  this.handleResponseError(models, 'delete');
10914
10957
  return throwError(error);
@@ -10935,7 +10978,7 @@ let RestService$1 = class RestService extends DataService {
10935
10978
  */
10936
10979
  handleResponse(response, method, mpData) {
10937
10980
  this.track(response, method, mpData);
10938
- if (this.getCache() && !this.disableCache) {
10981
+ if (this.getCache()) {
10939
10982
  this.updateCache(response, method);
10940
10983
  }
10941
10984
  // dispatch event for interested services
@@ -10990,7 +11033,7 @@ let RestService$1 = class RestService extends DataService {
10990
11033
  * @param methods The list of http methods should be listened for
10991
11034
  * @param callback The function to be called when event triggered
10992
11035
  */
10993
- listenCSE(modelClass, methods, callback) {
11036
+ listenCSE(modelClass, callback, methods = ['post', 'put', 'delete']) {
10994
11037
  callback = callback.bind(this);
10995
11038
  methods.forEach((method) => {
10996
11039
  this.eventDispatcherService.on2(modelClass.getEventName(method)).subscribe((data) => {
@@ -11008,15 +11051,29 @@ let RestService$1 = class RestService extends DataService {
11008
11051
  return !!intersection(JSON.parse(localStorage.getItem('roles')), this.roles).length;
11009
11052
  }
11010
11053
  /**
11011
- * // @TODO Alex remove
11012
- * Method that call all listeners. Empty by default. Should be redefined by child services if required
11013
- */
11014
- listenEvents() { }
11015
- /**
11016
- * Listen SSE events
11054
+ * Listen for Server-Sent Events (SSE) on the specified Mercure topic
11017
11055
  */
11018
- listenSSE() { }
11019
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11056
+ listenSSE() {
11057
+ if (!this.mercureTopic) {
11058
+ return;
11059
+ }
11060
+ this.sseService.on(this.mercureTopic).pipe(map((response) => {
11061
+ let model = this.createModelInstance(response);
11062
+ let method;
11063
+ if (model.id) {
11064
+ method = this.hasInCache(model.id) ? 'put' : 'post';
11065
+ }
11066
+ else {
11067
+ method = 'delete';
11068
+ // we got empty body when item deleted, so we should get id from Api Platform data (@id)
11069
+ model = merge(model, { id: +last$1(model['@id'].split('/')) });
11070
+ }
11071
+ return { method, model };
11072
+ })).subscribe((change) => {
11073
+ this.handleResponse([change.model], change.method);
11074
+ });
11075
+ }
11076
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11020
11077
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, providedIn: 'root' }); }
11021
11078
  };
11022
11079
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService$1, decorators: [{
@@ -11024,7 +11081,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11024
11081
  args: [{
11025
11082
  providedIn: 'root'
11026
11083
  }]
11027
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
11084
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
11028
11085
  type: Inject,
11029
11086
  args: ['environment']
11030
11087
  }] }]; } });
@@ -11034,7 +11091,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11034
11091
  */
11035
11092
  class BankAccountService extends RestService$1 {
11036
11093
  constructor(http, eventDispatcherService, sseService, environment) {
11037
- super(http, eventDispatcherService, environment);
11094
+ super(environment);
11038
11095
  this.http = http;
11039
11096
  this.eventDispatcherService = eventDispatcherService;
11040
11097
  this.sseService = sseService;
@@ -11043,16 +11100,17 @@ class BankAccountService extends RestService$1 {
11043
11100
  this.modelClass = BankAccount;
11044
11101
  this.collectionClass = BankAccountCollection;
11045
11102
  this.disabledMethods = ['post', 'putBatch', 'delete', 'deleteBatch'];
11046
- this.listenConnections();
11103
+ this.listenEvents();
11047
11104
  }
11048
11105
  /**
11049
11106
  * Listen system notifications and update cache when got basiq notification received
11050
11107
  */
11051
11108
  listenEvents() {
11052
11109
  this.listenToEventDispatcherChanges();
11053
- this.listenCSE(BankTransaction, ['post', 'delete'], this.refreshCache);
11054
- this.listenCSE(PropertyShare, ['put'], this.refreshCache);
11055
- this.listenCSE(BankConnection, ['post'], this.refreshCache);
11110
+ this.listenCSE(BankTransaction, this.refreshCache, ['post', 'delete']);
11111
+ this.listenCSE(PropertyShare, this.refreshCache, ['put']);
11112
+ this.listenCSE(BankConnection, this.refreshCache, ['post']);
11113
+ this.listenConnections();
11056
11114
  }
11057
11115
  /**
11058
11116
  * Update bank account current balance
@@ -11078,7 +11136,7 @@ class BankAccountService extends RestService$1 {
11078
11136
  });
11079
11137
  }
11080
11138
  /**
11081
- * @TODO don't refresh the whole cache, update what's needed
11139
+ * @TODO remove when TT-3826 is ready
11082
11140
  * manualConnection moved to basiq, old manual bankAccounts closed to let user add automated bankAccounts (because there is no reliable way to merge)
11083
11141
  */
11084
11142
  listenConnections() {
@@ -11127,18 +11185,19 @@ var BankConnectionMessagesEnum;
11127
11185
  * service handles BankConnection management
11128
11186
  */
11129
11187
  class BankConnectionService extends RestService$1 {
11130
- constructor(http, eventDispatcherService, sseService, environment) {
11131
- super(http, eventDispatcherService, environment);
11132
- this.http = http;
11133
- this.eventDispatcherService = eventDispatcherService;
11134
- this.sseService = sseService;
11188
+ constructor(environment) {
11189
+ super(environment);
11135
11190
  this.environment = environment;
11136
- this.isApiPlatform = true;
11137
11191
  this.modelClass = BankConnection;
11138
11192
  this.collectionClass = Collection;
11139
11193
  this.endpointUri = 'bank-connections';
11140
11194
  this.disabledMethods = ['postBatch', 'putBatch', 'delete', 'deleteBatch'];
11141
- this.listenBankConnections();
11195
+ this.mercureTopic = 'bankConnections';
11196
+ this.listenEvents();
11197
+ }
11198
+ listenEvents() {
11199
+ // @TODO remove when TT-3826 is ready
11200
+ this.listenSSE();
11142
11201
  }
11143
11202
  /**
11144
11203
  * there is no put BankConnection method, we have to post to update
@@ -11183,15 +11242,7 @@ class BankConnectionService extends RestService$1 {
11183
11242
  deactivate(bankConnection) {
11184
11243
  return this.put(bankConnection, null, `${this.apiUrl}/${bankConnection.id}/deactivate`);
11185
11244
  }
11186
- /**
11187
- * connection's status updated in background on backend, so reset cache required to inform user
11188
- */
11189
- listenBankConnections() {
11190
- this.sseService.on(`bankConnections`).subscribe((bankConnection) => {
11191
- this.refreshCache();
11192
- });
11193
- }
11194
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankConnectionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: SseService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11245
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankConnectionService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11195
11246
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankConnectionService, providedIn: 'root' }); }
11196
11247
  }
11197
11248
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankConnectionService, decorators: [{
@@ -11199,7 +11250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11199
11250
  args: [{
11200
11251
  providedIn: 'root'
11201
11252
  }]
11202
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: SseService }, { type: undefined, decorators: [{
11253
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
11203
11254
  type: Inject,
11204
11255
  args: ['environment']
11205
11256
  }] }]; } });
@@ -11256,12 +11307,14 @@ var UserEventTypeTypeEnum;
11256
11307
  * Service for bank transactions business logic
11257
11308
  */
11258
11309
  class BankTransactionService extends RestService$1 {
11259
- constructor() {
11260
- super(...arguments);
11310
+ constructor(environment) {
11311
+ super(environment);
11312
+ this.environment = environment;
11261
11313
  this.endpointUri = 'bank-transactions';
11262
11314
  this.modelClass = BankTransaction;
11263
11315
  this.collectionClass = BankTransactionCollection;
11264
11316
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'deleteBatch'];
11317
+ this.listenEvents();
11265
11318
  }
11266
11319
  listenEvents() {
11267
11320
  this.listenBankTransactionsImport();
@@ -11306,7 +11359,7 @@ class BankTransactionService extends RestService$1 {
11306
11359
  }
11307
11360
  });
11308
11361
  }
11309
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankTransactionService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
11362
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankTransactionService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11310
11363
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankTransactionService, providedIn: 'root' }); }
11311
11364
  }
11312
11365
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankTransactionService, decorators: [{
@@ -11314,7 +11367,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11314
11367
  args: [{
11315
11368
  providedIn: 'root'
11316
11369
  }]
11317
- }] });
11370
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
11371
+ type: Inject,
11372
+ args: ['environment']
11373
+ }] }]; } });
11318
11374
 
11319
11375
  /**
11320
11376
  * @TODO Alex shouldn't be a separated service, move to basiqService or interceptor
@@ -11369,7 +11425,7 @@ class BasiqService extends RestService$1 {
11369
11425
  constructor(http, eventDispatcherService, environment,
11370
11426
  // this inject required to init bank connection service and listen basiq login event
11371
11427
  bankConnectionService) {
11372
- super(http, eventDispatcherService, environment);
11428
+ super(environment);
11373
11429
  this.http = http;
11374
11430
  this.eventDispatcherService = eventDispatcherService;
11375
11431
  this.environment = environment;
@@ -11378,6 +11434,7 @@ class BasiqService extends RestService$1 {
11378
11434
  this.collectionClass = BankAccountCollection;
11379
11435
  this.modelClass = BankAccount;
11380
11436
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
11437
+ this.listenEvents();
11381
11438
  }
11382
11439
  /**
11383
11440
  * Listen events from Event Dispatcher service
@@ -11391,11 +11448,10 @@ class BasiqService extends RestService$1 {
11391
11448
  */
11392
11449
  deleteBasiq(connection) {
11393
11450
  return this.http.put(`${this.environment.apiV2}/bank-connections/${connection.id}/remove-basiq`, {})
11394
- .pipe(map((connection) => {
11395
- return connection;
11396
- // @TODO Alex token should be inside this service
11397
- // this.redirectToBasiqConsent(token.value, connection.bank.externalId, true);
11398
- }));
11451
+ .pipe(map((connection) => connection
11452
+ // @TODO Alex token should be inside this service
11453
+ // this.redirectToBasiqConsent(token.value, connection.bank.externalId, true);
11454
+ ));
11399
11455
  }
11400
11456
  revokeConsent() {
11401
11457
  return this.http.delete(`${this.environment.apiV2}/basiq/consent`);
@@ -11497,7 +11553,6 @@ class BankService extends RestService$1 {
11497
11553
  this.modelClass = Bank;
11498
11554
  this.collectionClass = Collection;
11499
11555
  this.endpointUri = 'banks';
11500
- this.isApiPlatform = true;
11501
11556
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
11502
11557
  }
11503
11558
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BankService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -11516,7 +11571,6 @@ class BudgetService extends RestService$1 {
11516
11571
  this.modelClass = Budget;
11517
11572
  this.collectionClass = Collection;
11518
11573
  this.endpointUri = 'budgets';
11519
- this.isApiPlatform = true;
11520
11574
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
11521
11575
  }
11522
11576
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BudgetService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -11546,7 +11600,6 @@ class ChartAccountsDepreciationService extends RestService$1 {
11546
11600
  this.endpointUri = 'chart-accounts-depreciations';
11547
11601
  this.modelClass = ChartAccountsDepreciation;
11548
11602
  this.collectionClass = Collection;
11549
- this.isApiPlatform = true;
11550
11603
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
11551
11604
  }
11552
11605
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChartAccountsDepreciationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -11605,16 +11658,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11605
11658
  * Service for work with chats
11606
11659
  */
11607
11660
  class ChatService extends RestService$1 {
11608
- constructor(http, eventDispatcherService, environment) {
11609
- super(http, eventDispatcherService, environment);
11610
- this.http = http;
11611
- this.eventDispatcherService = eventDispatcherService;
11661
+ constructor(environment) {
11662
+ super(environment);
11612
11663
  this.environment = environment;
11613
11664
  this.modelClass = Chat;
11614
11665
  this.collectionClass = ChatCollection;
11615
11666
  this.endpointUri = 'chats';
11616
- this.isApiPlatform = true;
11617
11667
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
11668
+ this.listenEvents();
11669
+ }
11670
+ listenEvents() {
11618
11671
  this.listenChats();
11619
11672
  this.listenMessages();
11620
11673
  }
@@ -11623,7 +11676,7 @@ class ChatService extends RestService$1 {
11623
11676
  return super.get(path).pipe(map((chats) => chats.filter((chat) => chat.employee.email !== this.environment.ttAdvisor)));
11624
11677
  }
11625
11678
  /**
11626
- * Listen chats events
11679
+ * @TODO refactor with listenSSE method
11627
11680
  */
11628
11681
  listenChats() {
11629
11682
  this.sseService.on(`chats`).subscribe((chatBase) => {
@@ -11657,15 +11710,15 @@ class ChatService extends RestService$1 {
11657
11710
  * Update chat's 'updatedAt' field with the last chat's message date for chat list sorting
11658
11711
  */
11659
11712
  listenMessages() {
11660
- this.listenCSE(Message, ['post'], (messages) => {
11713
+ this.listenCSE(Message, (messages) => {
11661
11714
  const message = messages[0];
11662
11715
  const cache = this.cache.toArray();
11663
11716
  const updatedChat = cache.find((chat) => chat?.id === message.chat?.id);
11664
11717
  updatedChat.updatedAt = message?.createdAt;
11665
11718
  this.handleResponse([updatedChat], 'put');
11666
- });
11719
+ }, ['post']);
11667
11720
  }
11668
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChatService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11721
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChatService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11669
11722
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChatService, providedIn: 'root' }); }
11670
11723
  }
11671
11724
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChatService, decorators: [{
@@ -11673,7 +11726,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11673
11726
  args: [{
11674
11727
  providedIn: 'root'
11675
11728
  }]
11676
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
11729
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
11677
11730
  type: Inject,
11678
11731
  args: ['environment']
11679
11732
  }] }]; } });
@@ -11682,48 +11735,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11682
11735
  * Service for work with messages
11683
11736
  */
11684
11737
  class MessageService extends RestService$1 {
11685
- constructor(http, eventDispatcherService, environment) {
11686
- super(http, eventDispatcherService, environment);
11687
- this.http = http;
11688
- this.eventDispatcherService = eventDispatcherService;
11738
+ constructor(environment) {
11739
+ super(environment);
11689
11740
  this.environment = environment;
11690
11741
  this.modelClass = Message;
11691
11742
  this.collectionClass = MessageCollection;
11692
11743
  this.endpointUri = 'messages';
11693
- this.isApiPlatform = true;
11694
11744
  this.disabledMethods = ['postBatch', 'putBatch'];
11695
- this.listenMessages();
11696
- }
11697
- /**
11698
- * Overwrite default methods because we need to handle messages via SSE events only
11699
- */
11700
- post(message) {
11701
- return this.http.post(this.apiUrl, message)
11702
- .pipe(map((response) => plainToClass(Message, response)));
11703
- }
11704
- /**
11705
- * Overwrite default methods because we need to handle messages via SSE events only
11706
- */
11707
- put(message) {
11708
- return this.http.put(`${this.apiUrl}/${message.id}`, message)
11709
- .pipe(map((response) => plainToClass(Message, response)));
11745
+ this.mercureTopic = 'messages';
11746
+ this.listenEvents();
11710
11747
  }
11711
- /**
11712
- * subscribe to new chat messages
11713
- */
11714
- listenMessages() {
11715
- this.sseService.on(`messages`).subscribe((messageBase) => {
11716
- const message = plainToClass(Message, messageBase);
11717
- // update existing message if read and add new message if not read
11718
- if (this.cache.findBy('id', message.id)) {
11719
- this.handleResponse([message], 'put');
11720
- }
11721
- else {
11722
- this.handleResponse([message], 'post');
11723
- }
11724
- });
11748
+ listenEvents() {
11749
+ this.listenSSE();
11725
11750
  }
11726
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11751
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11727
11752
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageService, providedIn: 'root' }); }
11728
11753
  }
11729
11754
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageService, decorators: [{
@@ -11731,7 +11756,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11731
11756
  args: [{
11732
11757
  providedIn: 'root'
11733
11758
  }]
11734
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
11759
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
11735
11760
  type: Inject,
11736
11761
  args: ['environment']
11737
11762
  }] }]; } });
@@ -11740,13 +11765,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11740
11765
  * Service for work with Message Documents
11741
11766
  */
11742
11767
  class MessageDocumentService extends RestService$1 {
11743
- constructor() {
11744
- super(...arguments);
11768
+ constructor(environment) {
11769
+ super(environment);
11770
+ this.environment = environment;
11745
11771
  this.modelClass = MessageDocument;
11746
11772
  this.collectionClass = MessageDocumentCollection;
11747
11773
  this.endpointUri = 'message-documents';
11748
11774
  this.disabledMethods = ['postBatch', 'deleteBatch', 'put', 'putBatch'];
11749
- this.isApiPlatform = true;
11775
+ this.listenEvents();
11750
11776
  }
11751
11777
  /**
11752
11778
  * SSE and Event Dispatcher Services listeners
@@ -11758,7 +11784,7 @@ class MessageDocumentService extends RestService$1 {
11758
11784
  * listen new messages event to update documents cache
11759
11785
  */
11760
11786
  listenMessages() {
11761
- this.listenCSE(Message, ['post'], (messages) => {
11787
+ this.listenCSE(Message, (messages) => {
11762
11788
  const message = messages[0];
11763
11789
  if (message.documents?.length) {
11764
11790
  const array = this.cache.toArray();
@@ -11772,7 +11798,7 @@ class MessageDocumentService extends RestService$1 {
11772
11798
  this.cache = new MessageDocumentCollection(array);
11773
11799
  this.cacheSubject.next(this.cache);
11774
11800
  }
11775
- });
11801
+ }, ['post']);
11776
11802
  }
11777
11803
  /**
11778
11804
  * Upload file to chat
@@ -11794,7 +11820,7 @@ class MessageDocumentService extends RestService$1 {
11794
11820
  addBatch(chatId, files) {
11795
11821
  return combineLatest(files.map((file) => this.add(chatId, file))).pipe(map((docsBase) => docsBase.map((docBase) => plainToClass(MessageDocument, docBase))));
11796
11822
  }
11797
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageDocumentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
11823
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageDocumentService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
11798
11824
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageDocumentService, providedIn: 'root' }); }
11799
11825
  }
11800
11826
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageDocumentService, decorators: [{
@@ -11802,11 +11828,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11802
11828
  args: [{
11803
11829
  providedIn: 'root'
11804
11830
  }]
11805
- }] });
11831
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
11832
+ type: Inject,
11833
+ args: ['environment']
11834
+ }] }]; } });
11806
11835
 
11807
11836
  class DepreciationService extends RestService$1 {
11808
11837
  constructor(http, eventDispatcherService, environment) {
11809
- super(http, eventDispatcherService, environment);
11838
+ super(environment);
11810
11839
  this.http = http;
11811
11840
  this.eventDispatcherService = eventDispatcherService;
11812
11841
  this.environment = environment;
@@ -11814,6 +11843,7 @@ class DepreciationService extends RestService$1 {
11814
11843
  this.collectionClass = DepreciationCollection;
11815
11844
  this.endpointUri = 'depreciations';
11816
11845
  this.disabledMethods = ['post', 'putBatch', 'deleteBatch'];
11846
+ this.listenEvents();
11817
11847
  }
11818
11848
  /**
11819
11849
  * Listen to Depreciations events
@@ -11842,17 +11872,17 @@ class DepreciationService extends RestService$1 {
11842
11872
  * Listen to EventDispatcherService event related to updated bank loan
11843
11873
  */
11844
11874
  listenToUpdatedLoan() {
11845
- this.listenCSE(Loan, ['put'], this.refreshCache);
11875
+ this.listenCSE(Loan, this.refreshCache, ['put']);
11846
11876
  }
11847
11877
  /**
11848
11878
  * Listen to EventDispatcherService event related to updated bank account
11849
11879
  */
11850
11880
  listenToUpdatedBankAccount() {
11851
- this.listenCSE(BankAccount, ['put'], (bankAccounts) => {
11881
+ this.listenCSE(BankAccount, (bankAccounts) => {
11852
11882
  if (bankAccounts.find(ba => ba.isPropertyTank())) {
11853
11883
  this.refreshCache();
11854
11884
  }
11855
- });
11885
+ }, ['put']);
11856
11886
  }
11857
11887
  /**
11858
11888
  * Listen to EventDispatcherService event related to updated vehicle claim
@@ -11959,7 +11989,6 @@ class DocumentService extends RestService$1 {
11959
11989
  this.modelClass = Document;
11960
11990
  this.collectionClass = Collection;
11961
11991
  this.disabledMethods = ['postBatch', 'putBatch'];
11962
- this.isApiPlatform = true;
11963
11992
  }
11964
11993
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DocumentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
11965
11994
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DocumentService, providedIn: 'root' }); }
@@ -11979,53 +12008,6 @@ var DocumentMessagesEnum;
11979
12008
  DocumentMessagesEnum["DELETED"] = "Document deleted!";
11980
12009
  })(DocumentMessagesEnum || (DocumentMessagesEnum = {}));
11981
12010
 
11982
- class AuthService {
11983
- constructor(http, jwtService, mpService, environment) {
11984
- this.http = http;
11985
- this.jwtService = jwtService;
11986
- this.mpService = mpService;
11987
- this.environment = environment;
11988
- this.isLoggedInSubject = new BehaviorSubject(!this.jwtService.isTokenExpired());
11989
- }
11990
- setAuth(response) {
11991
- this.jwtService.saveTokens(response);
11992
- this.isLoggedInSubject.next(true);
11993
- }
11994
- login(username, password) {
11995
- return this.http.post(`${this.environment.apiV2}/login`, { username, password }).pipe(map((response) => {
11996
- this.setAuth(response);
11997
- this.mpService.track('login');
11998
- return response;
11999
- }), catchError((error) => {
12000
- this.mpService.track('loginError', { username });
12001
- return throwError(error);
12002
- }));
12003
- }
12004
- refresh(refreshToken) {
12005
- return this.http.post(`${this.environment.apiV2}/token/refresh`, { refreshToken }).pipe(map((response) => {
12006
- this.setAuth(response);
12007
- return response;
12008
- }));
12009
- }
12010
- logoutFront(url = '/login') {
12011
- localStorage.clear();
12012
- this.mpService.track('logout');
12013
- this.mpService.reset();
12014
- location.replace(url);
12015
- }
12016
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, deps: [{ token: i1.HttpClient }, { token: JwtService }, { token: MixpanelService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12017
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, providedIn: 'root' }); }
12018
- }
12019
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, decorators: [{
12020
- type: Injectable,
12021
- args: [{
12022
- providedIn: 'root'
12023
- }]
12024
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: JwtService }, { type: MixpanelService }, { type: undefined, decorators: [{
12025
- type: Inject,
12026
- args: ['environment']
12027
- }] }]; } });
12028
-
12029
12011
  const ERROR_EMAIL_PERMISSION = 'Access to email denied. Please provide access to email in facebook.';
12030
12012
  class FacebookService {
12031
12013
  static { this.authOptions = {
@@ -12186,7 +12168,6 @@ class FileService extends RestService$1 {
12186
12168
  this.endpointUri = 'files';
12187
12169
  this.modelClass = AppFile;
12188
12170
  this.collectionClass = Collection;
12189
- this.isApiPlatform = true;
12190
12171
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
12191
12172
  }
12192
12173
  getById(id) {
@@ -12219,7 +12200,6 @@ class ClientIncomeTypesService extends RestService$1 {
12219
12200
  this.modelClass = ClientIncomeTypes;
12220
12201
  this.collectionClass = Collection;
12221
12202
  this.endpointUri = 'client-income-types';
12222
- this.isApiPlatform = true;
12223
12203
  this.disabledMethods = ['postBatch', 'putBatch', 'delete', 'deleteBatch'];
12224
12204
  }
12225
12205
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientIncomeTypesService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -12233,11 +12213,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12233
12213
  }] });
12234
12214
 
12235
12215
  class ClientInviteService extends RestService$1 {
12236
- constructor() {
12237
- super(...arguments);
12216
+ constructor(environment) {
12217
+ super(environment);
12218
+ this.environment = environment;
12238
12219
  this.endpointUri = 'clients/invites';
12239
12220
  this.collectionClass = ClientInviteCollection;
12240
12221
  this.modelClass = ClientInvite;
12222
+ this.mercureTopic = 'clientInvites';
12223
+ this.listenEvents();
12224
+ }
12225
+ listenEvents() {
12226
+ // @TODO remove when TT-3826 is ready
12227
+ this.listenSSE();
12241
12228
  }
12242
12229
  getFirmInvites() {
12243
12230
  return super.get(`${this.apiUrl}/all`);
@@ -12303,29 +12290,7 @@ class ClientInviteService extends RestService$1 {
12303
12290
  return throwError(error);
12304
12291
  }));
12305
12292
  }
12306
- /**
12307
- * Listem clientInvites db changes via mercure to update cache
12308
- * @TODO make it universal and move to parent
12309
- */
12310
- listenSSE() {
12311
- this.sseService.on('clientInvites')
12312
- .pipe(map((clientInvite) => plainToClass(ClientInvite, clientInvite)))
12313
- .subscribe((clientInvite) => {
12314
- // we got empty body when item deleted so we should get id from Api Platform data (@id)
12315
- const id = clientInvite.id ?? +last(clientInvite['@id'].split('/'));
12316
- switch (true) {
12317
- case !clientInvite.id:
12318
- this.updateCache([merge(clientInvite, { id })], 'delete');
12319
- break;
12320
- case this.hasInCache(id):
12321
- this.updateCache([clientInvite], 'put');
12322
- break;
12323
- case !this.hasInCache(id):
12324
- this.updateCache([clientInvite], 'post');
12325
- }
12326
- });
12327
- }
12328
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientInviteService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12293
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientInviteService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12329
12294
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientInviteService, providedIn: 'root' }); }
12330
12295
  }
12331
12296
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientInviteService, decorators: [{
@@ -12333,7 +12298,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12333
12298
  args: [{
12334
12299
  providedIn: 'root'
12335
12300
  }]
12336
- }] });
12301
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
12302
+ type: Inject,
12303
+ args: ['environment']
12304
+ }] }]; } });
12337
12305
 
12338
12306
  var ClientInviteMessages;
12339
12307
  (function (ClientInviteMessages) {
@@ -12351,17 +12319,21 @@ var ClientInviteMessages;
12351
12319
  })(ClientInviteMessages || (ClientInviteMessages = {}));
12352
12320
 
12353
12321
  class ClientMovementService extends RestService$1 {
12354
- constructor() {
12355
- super(...arguments);
12322
+ constructor(environment) {
12323
+ super(environment);
12324
+ this.environment = environment;
12356
12325
  this.endpointUri = 'client-movements';
12357
12326
  this.collectionClass = ClientMovementCollection;
12358
12327
  this.modelClass = ClientMovement;
12359
- this.isApiPlatform = true;
12360
12328
  this.disabledMethods = ['postBatch', 'delete', 'deleteBatch'];
12329
+ this.mercureTopic = 'clientMovements';
12330
+ this.listenEvents();
12361
12331
  }
12362
12332
  listenEvents() {
12363
- // @TODO handle with mercure
12364
- this.listenCSE(ClientInvite, ['post', 'put', 'delete'], this.refreshCache);
12333
+ // client invite accept triggers client movement update
12334
+ this.listenCSE(ClientInvite, this.refreshCache, ['post', 'put', 'delete']);
12335
+ // @TODO remove when TT-3826 is ready
12336
+ this.listenSSE();
12365
12337
  }
12366
12338
  getActive() {
12367
12339
  return this.get().pipe(map((clientMovements) => clientMovements.active));
@@ -12408,18 +12380,7 @@ class ClientMovementService extends RestService$1 {
12408
12380
  this.updateCache([clientMovement], 'delete');
12409
12381
  }));
12410
12382
  }
12411
- /**
12412
- * Listem clientMovements db changes via mercure to update cache
12413
- * @TODO make it universal and move to parent
12414
- */
12415
- listenSSE() {
12416
- this.sseService.on('clientMovements')
12417
- .pipe(map((clientMovement) => plainToClass(ClientMovement, clientMovement)))
12418
- .subscribe((clientMovement) => {
12419
- this.hasInCache(clientMovement.id) ? this.updateCache([clientMovement], 'put') : this.updateCache([clientMovement], 'post');
12420
- });
12421
- }
12422
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientMovementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12383
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientMovementService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12423
12384
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientMovementService, providedIn: 'root' }); }
12424
12385
  }
12425
12386
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClientMovementService, decorators: [{
@@ -12427,7 +12388,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12427
12388
  args: [{
12428
12389
  providedIn: 'root'
12429
12390
  }]
12430
- }] });
12391
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
12392
+ type: Inject,
12393
+ args: ['environment']
12394
+ }] }]; } });
12431
12395
 
12432
12396
  /**
12433
12397
  * Abstract base service that implements common services functionality
@@ -12437,16 +12401,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12437
12401
  * @TODO TT-1777 Alex: remove when all services refactored
12438
12402
  */
12439
12403
  class RestService {
12440
- constructor(http, eventDispatcherService, environment, toastService) {
12441
- this.http = http;
12442
- this.eventDispatcherService = eventDispatcherService;
12404
+ constructor(environment) {
12443
12405
  this.environment = environment;
12444
- this.toastService = toastService;
12406
+ this.toastService = inject(ToastService);
12407
+ this.http = inject(HttpClient);
12408
+ this.eventDispatcherService = inject(EventDispatcherService);
12445
12409
  // subject for service cache
12446
12410
  this.cacheSubject = new ReplaySubject(1);
12447
12411
  this.mpService = inject(MixpanelService);
12448
12412
  this.roles = [];
12449
- this.listenEvents();
12450
12413
  }
12451
12414
  get apiUrl() {
12452
12415
  return `${this.environment.apiV2}/${this.url}`;
@@ -12460,8 +12423,7 @@ class RestService {
12460
12423
  }
12461
12424
  return this.http.get(path)
12462
12425
  .pipe(map((response) => {
12463
- const items = (this.isHydra ? response['hydra:member'] : response)
12464
- .map((item) => this.createModelInstance(item));
12426
+ const items = response.map((item) => this.createModelInstance(item));
12465
12427
  if (cache) {
12466
12428
  this.setCache(items, true);
12467
12429
  }
@@ -12642,13 +12604,9 @@ class RestService {
12642
12604
  * @param model instance that we will use as constructor options
12643
12605
  */
12644
12606
  createModelInstance(model) {
12645
- return plainToClass(this.modelClass, model, { excludePrefixes: ['@'] });
12607
+ return plainToClass(this.modelClass, model);
12646
12608
  }
12647
- /**
12648
- * Method that call all listeners. Empty by default. Should be redefined by child services if required
12649
- */
12650
- listenEvents() { }
12651
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable }); }
12609
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12652
12610
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, providedIn: 'root' }); }
12653
12611
  }
12654
12612
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestService, decorators: [{
@@ -12656,10 +12614,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12656
12614
  args: [{
12657
12615
  providedIn: 'root'
12658
12616
  }]
12659
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
12617
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
12660
12618
  type: Inject,
12661
12619
  args: ['environment']
12662
- }] }, { type: ToastService }]; } });
12620
+ }] }]; } });
12663
12621
 
12664
12622
  var EmployeeMessagesEnum;
12665
12623
  (function (EmployeeMessagesEnum) {
@@ -12860,7 +12818,7 @@ class FirmService {
12860
12818
  */
12861
12819
  getAll() {
12862
12820
  return this.http.get(`${this.environment.apiV2}/firms`)
12863
- .pipe(map((response) => response['hydra:member'].map((firmBase) => plainToClass(Firm, firmBase))));
12821
+ .pipe(map((response) => response.map((firmBase) => plainToClass(Firm, firmBase))));
12864
12822
  }
12865
12823
  getByType(type) {
12866
12824
  return this.getAll().pipe(map((firms) => firms.filter((firm) => firm.type === type)));
@@ -12882,10 +12840,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12882
12840
  * Service to work with Other Income Forecasts
12883
12841
  */
12884
12842
  class IncomeSourceForecastService extends RestService {
12885
- constructor() {
12886
- super(...arguments);
12843
+ constructor(environment) {
12844
+ super(environment);
12845
+ this.environment = environment;
12887
12846
  this.modelClass = IncomeSourceForecast;
12888
12847
  this.url = 'income-source-forecasts';
12848
+ this.listenEvents();
12889
12849
  }
12890
12850
  /**
12891
12851
  * Listen to Income Sources events
@@ -12941,7 +12901,7 @@ class IncomeSourceForecastService extends RestService {
12941
12901
  return incomeSource.incomeSourceForecasts;
12942
12902
  }).flat();
12943
12903
  }
12944
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12904
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceForecastService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
12945
12905
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceForecastService, providedIn: 'root' }); }
12946
12906
  }
12947
12907
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceForecastService, decorators: [{
@@ -12949,16 +12909,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
12949
12909
  args: [{
12950
12910
  providedIn: 'root'
12951
12911
  }]
12952
- }] });
12912
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
12913
+ type: Inject,
12914
+ args: ['environment']
12915
+ }] }]; } });
12953
12916
 
12954
12917
  /**
12955
12918
  * Service to work with Salary Forecasts
12956
12919
  */
12957
12920
  class SalaryForecastService extends RestService {
12958
- constructor() {
12959
- super(...arguments);
12921
+ constructor(environment) {
12922
+ super(environment);
12923
+ this.environment = environment;
12960
12924
  this.modelClass = SalaryForecast;
12961
12925
  this.url = 'salary-forecasts';
12926
+ this.listenEvents();
12962
12927
  }
12963
12928
  /**
12964
12929
  * Listen to Income Sources events
@@ -13013,7 +12978,7 @@ class SalaryForecastService extends RestService {
13013
12978
  return incomeSource.salaryForecasts;
13014
12979
  }).flat();
13015
12980
  }
13016
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SalaryForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
12981
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SalaryForecastService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13017
12982
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SalaryForecastService, providedIn: 'root' }); }
13018
12983
  }
13019
12984
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SalaryForecastService, decorators: [{
@@ -13021,13 +12986,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13021
12986
  args: [{
13022
12987
  providedIn: 'root'
13023
12988
  }]
13024
- }] });
12989
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
12990
+ type: Inject,
12991
+ args: ['environment']
12992
+ }] }]; } });
13025
12993
 
13026
12994
  class SoleForecastService extends RestService {
13027
- constructor() {
13028
- super(...arguments);
12995
+ constructor(environment) {
12996
+ super(environment);
12997
+ this.environment = environment;
13029
12998
  this.modelClass = SoleForecast;
13030
12999
  this.url = 'sole-forecasts';
13000
+ this.listenEvents();
13031
13001
  }
13032
13002
  /**
13033
13003
  * Listen to Income Sources events
@@ -13092,7 +13062,7 @@ class SoleForecastService extends RestService {
13092
13062
  this.refreshCache();
13093
13063
  });
13094
13064
  }
13095
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleForecastService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13065
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleForecastService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13096
13066
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleForecastService, providedIn: 'root' }); }
13097
13067
  }
13098
13068
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleForecastService, decorators: [{
@@ -13100,16 +13070,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13100
13070
  args: [{
13101
13071
  providedIn: 'root'
13102
13072
  }]
13103
- }] });
13073
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
13074
+ type: Inject,
13075
+ args: ['environment']
13076
+ }] }]; } });
13104
13077
 
13105
13078
  /**
13106
13079
  * Service to work with income sources
13107
13080
  */
13108
13081
  class IncomeSourceService extends RestService {
13109
- constructor() {
13110
- super(...arguments);
13082
+ constructor(environment) {
13083
+ super(environment);
13084
+ this.environment = environment;
13111
13085
  this.url = 'income-sources';
13112
13086
  this.modelClass = IncomeSource;
13087
+ this.listenEvents();
13113
13088
  }
13114
13089
  listenEvents() {
13115
13090
  this.listenSoleBusinessCreated();
@@ -13173,7 +13148,7 @@ class IncomeSourceService extends RestService {
13173
13148
  this.refreshCache();
13174
13149
  });
13175
13150
  }
13176
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13151
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13177
13152
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceService, providedIn: 'root' }); }
13178
13153
  }
13179
13154
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IncomeSourceService, decorators: [{
@@ -13181,7 +13156,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13181
13156
  args: [{
13182
13157
  providedIn: 'root'
13183
13158
  }]
13184
- }] });
13159
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
13160
+ type: Inject,
13161
+ args: ['environment']
13162
+ }] }]; } });
13185
13163
 
13186
13164
  var IncomeSourceMessagesEnum;
13187
13165
  (function (IncomeSourceMessagesEnum) {
@@ -13263,24 +13241,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13263
13241
  * Service that handling loans logic
13264
13242
  */
13265
13243
  class LoanService extends RestService$1 {
13266
- constructor() {
13267
- super(...arguments);
13244
+ constructor(environment) {
13245
+ super(environment);
13246
+ this.environment = environment;
13268
13247
  this.endpointUri = 'bank-accounts/loans';
13269
13248
  this.modelClass = Loan;
13270
13249
  this.collectionClass = LoanCollection;
13271
13250
  this.disabledMethods = ['post', 'delete', 'deleteBatch'];
13251
+ this.listenEvents();
13272
13252
  }
13273
13253
  /**
13274
13254
  * Listen to Loans events
13275
13255
  */
13276
13256
  listenEvents() {
13277
13257
  // Update list of loans when added/changed loan bank account
13278
- this.listenCSE(BankAccount, ['post', 'put'], (bankAccounts) => {
13258
+ this.listenCSE(BankAccount, (bankAccounts) => {
13279
13259
  if (bankAccounts.find(ba => !!ba.loan)) {
13280
13260
  this.refreshCache();
13281
13261
  }
13282
- });
13283
- this.listenCSE(LoanPayout, ['post', 'put', 'delete'], this.refreshCache);
13262
+ }, ['post', 'put']);
13263
+ this.listenCSE(LoanPayout, this.refreshCache, ['post', 'put', 'delete']);
13284
13264
  }
13285
13265
  /**
13286
13266
  * Calculate loan payments
@@ -13328,7 +13308,7 @@ class LoanService extends RestService$1 {
13328
13308
  this.refreshCache();
13329
13309
  }));
13330
13310
  }
13331
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LoanService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13311
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LoanService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13332
13312
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LoanService, providedIn: 'root' }); }
13333
13313
  }
13334
13314
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LoanService, decorators: [{
@@ -13336,13 +13316,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13336
13316
  args: [{
13337
13317
  providedIn: 'root'
13338
13318
  }]
13339
- }] });
13319
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
13320
+ type: Inject,
13321
+ args: ['environment']
13322
+ }] }]; } });
13340
13323
 
13341
13324
  class BorrowingReportService extends RestService$1 {
13342
13325
  constructor() {
13343
13326
  super(...arguments);
13344
13327
  this.endpointUri = 'borrowing-reports';
13345
- this.isApiPlatform = true;
13346
13328
  this.modelClass = BorrowingReport;
13347
13329
  this.collectionClass = Collection;
13348
13330
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
@@ -13390,11 +13372,12 @@ class PropertyCategoryMovementService extends RestService$1 {
13390
13372
  super(...arguments);
13391
13373
  this.modelClass = PropertyCategoryMovement;
13392
13374
  this.collectionClass = PropertyCategoryMovementCollection;
13393
- this.endpointUri = 'properties/category-movements';
13375
+ this.endpointUri = 'property-category-movements';
13394
13376
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
13395
13377
  }
13396
13378
  post(movement, property) {
13397
- return super.post(movement, property, `${this.environment.apiV2}/properties/${movement.property.id}/category-movements`);
13379
+ movement.property = movement.valuation.property = plainToClass(Property, { id: property.id });
13380
+ return super.post(movement, property);
13398
13381
  }
13399
13382
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyCategoryMovementService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13400
13383
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyCategoryMovementService, providedIn: 'root' }); }
@@ -13424,30 +13407,6 @@ class PropertyDocumentService extends RestService$1 {
13424
13407
  this.collectionClass = Collection;
13425
13408
  this.endpointUri = 'property-documents';
13426
13409
  this.disabledMethods = ['postBatch', 'putBatch'];
13427
- this.isApiPlatform = true;
13428
- }
13429
- /**
13430
- * Add new Property Document
13431
- */
13432
- upload(file, propertyId) {
13433
- // create formData object with provided file
13434
- const formDataDocument = new FormData();
13435
- formDataDocument.append('file', file);
13436
- return this.http.post(`${this.environment.apiV2}/properties/${propertyId}/documents`, formDataDocument).pipe(map((documentBase) => {
13437
- const newDocument = plainToClass(PropertyDocument, documentBase);
13438
- if (this.cache) {
13439
- this.updateCache([newDocument], 'post');
13440
- }
13441
- return newDocument;
13442
- }));
13443
- }
13444
- listenEvents() {
13445
- this.listenPropertyUpdateWithDocument();
13446
- }
13447
- listenPropertyUpdateWithDocument() {
13448
- this.eventDispatcherService.on(AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT).subscribe((property) => {
13449
- this.upload(property.documentFile, property.id).subscribe();
13450
- });
13451
13410
  }
13452
13411
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyDocumentService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13453
13412
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyDocumentService, providedIn: 'root' }); }
@@ -13496,13 +13455,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13496
13455
 
13497
13456
  // @TODO check and improve logic during refactoring
13498
13457
  class PropertyShareService extends RestService$1 {
13499
- constructor() {
13500
- super(...arguments);
13458
+ constructor(environment) {
13459
+ super(environment);
13460
+ this.environment = environment;
13501
13461
  // api url parameter for properties shares
13502
13462
  this.endpointUri = 'properties/shares';
13503
13463
  this.modelClass = PropertyShare;
13504
13464
  this.collectionClass = PropertyShareCollection;
13505
13465
  this.disabledMethods = ['deleteBatch', 'putBatch', 'postBatch'];
13466
+ this.listenEvents();
13506
13467
  }
13507
13468
  /**
13508
13469
  * Listen to Event Dispatcher events
@@ -13536,9 +13497,9 @@ class PropertyShareService extends RestService$1 {
13536
13497
  * @Todo Alex refactor after PropertyShare functionality in PropertyService will be cleared up
13537
13498
  */
13538
13499
  listenSalesChanges() {
13539
- this.listenCSE(PropertySale, ['post', 'delete'], this.refreshCache);
13500
+ this.listenCSE(PropertySale, this.refreshCache, ['post', 'delete']);
13540
13501
  }
13541
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyShareService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13502
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyShareService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13542
13503
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyShareService, providedIn: 'root' }); }
13543
13504
  }
13544
13505
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyShareService, decorators: [{
@@ -13546,29 +13507,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13546
13507
  args: [{
13547
13508
  providedIn: 'root'
13548
13509
  }]
13549
- }] });
13510
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
13511
+ type: Inject,
13512
+ args: ['environment']
13513
+ }] }]; } });
13550
13514
 
13551
- /**
13552
- * @TODO Alex: refacotor with api platform (old endpoint)
13553
- */
13554
13515
  class PropertyValuationService extends RestService$1 {
13555
13516
  constructor() {
13556
13517
  super(...arguments);
13557
- this.endpointUri = 'properties';
13518
+ this.endpointUri = 'property-valuations';
13558
13519
  this.modelClass = PropertyValuation;
13559
13520
  this.collectionClass = (Collection);
13560
13521
  this.disabledMethods = ['postBatch', 'putBatch'];
13561
- this.isApiPlatform = true;
13562
- }
13563
- get(propertyId) {
13564
- return this.http.get(`${this.apiUrl}/${propertyId}/valuations`)
13565
- .pipe(map((valuations) => new Collection(valuations.map((valuation) => plainToClass(PropertyValuation, valuation)))));
13566
13522
  }
13567
13523
  post(valuation, property) {
13568
- return super.post(valuation, property, `${this.apiUrl}/${property.id}/valuations`);
13569
- }
13570
- put(valuation, property) {
13571
- return super.put(valuation, property, `${this.apiUrl}/${property.id}/valuations/${valuation.id}`);
13524
+ valuation.property = plainToClass(Property, { id: property.id });
13525
+ return super.post(valuation, property);
13572
13526
  }
13573
13527
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyValuationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13574
13528
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyValuationService, providedIn: 'root' }); }
@@ -13598,53 +13552,36 @@ var PropertyMessagesEnum;
13598
13552
  * Service for work with Property
13599
13553
  */
13600
13554
  class PropertyService extends RestService$1 {
13601
- constructor() {
13602
- super(...arguments);
13555
+ constructor(environment) {
13556
+ super(environment);
13557
+ this.environment = environment;
13603
13558
  this.modelClass = Property;
13604
13559
  this.collectionClass = PropertyCollection;
13605
13560
  this.endpointUri = 'properties';
13606
13561
  this.disabledMethods = ['deleteBatch'];
13562
+ this.listenEvents();
13607
13563
  }
13564
+ /**
13565
+ * @TODO remove when forecast moved to separated api
13566
+ */
13608
13567
  put(property) {
13609
13568
  return super.put(property)
13610
- // @TODO Alex (TT-1777): handle this events and refactor
13611
13569
  .pipe(map((updatedProperty) => {
13612
- if (property.documentFile) {
13613
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.PROPERTY_UPDATED_WITH_DOCUMENT, property));
13614
- }
13615
- else {
13616
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.PROPERTY_UPDATED, property));
13617
- }
13570
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.PROPERTY_UPDATED, property));
13618
13571
  return updatedProperty;
13619
13572
  }));
13620
13573
  }
13621
- listenEvents() {
13622
- this.listenShareInviteAccepted();
13623
- // @TODO Alex: consider to refactor property movements logic similar to client-movements
13624
- this.listenMovementsChanges();
13625
- this.listenSalesChanges();
13626
- this.listenValuations();
13627
- }
13628
- /**
13629
- * Update cache when share invitation accepted
13630
- */
13631
- listenShareInviteAccepted() {
13632
- this.listenCSE(PropertyShare, ['put'], this.refreshCache);
13633
- }
13634
- /**
13635
- * Update cache when property category changed
13636
- */
13637
- listenMovementsChanges() {
13638
- this.listenCSE(PropertyCategoryMovement, ['post', 'put', 'delete'], this.refreshCache);
13639
- }
13640
13574
  /**
13641
- * Update cache when property sales changed
13575
+ * @TODO no refresh cache with this.updateCache([this.getCache().findBy('id', change.model.property.id)], 'put');
13642
13576
  */
13643
- listenSalesChanges() {
13644
- this.listenCSE(PropertySale, ['post', 'delete'], this.refreshCache);
13645
- }
13646
- listenValuations() {
13647
- this.listenCSE(PropertyValuation, ['post', 'put'], this.refreshCache);
13577
+ listenEvents() {
13578
+ // share invite accepted event gives access to new property
13579
+ this.listenCSE(PropertyShare, this.refreshCache, ['put']);
13580
+ // @TODO get from separated api?
13581
+ this.listenCSE(PropertySale, this.refreshCache, ['post', 'put', 'delete']);
13582
+ // property caches child entities to improve performance
13583
+ this.listenCSE(PropertyValuation, this.refreshCache);
13584
+ this.listenCSE(PropertyCategoryMovement, this.refreshCache);
13648
13585
  }
13649
13586
  updateDepreciationCalculation(property) {
13650
13587
  const propertyToUpdate = plainToClass(Property, { id: property.id, depreciationCalculation: property.depreciationCalculation });
@@ -13654,6 +13591,7 @@ class PropertyService extends RestService$1 {
13654
13591
  }));
13655
13592
  }
13656
13593
  /**
13594
+ * @TODO move to separated api
13657
13595
  * Activate deactivated property
13658
13596
  */
13659
13597
  activate(property) {
@@ -13673,6 +13611,7 @@ class PropertyService extends RestService$1 {
13673
13611
  }));
13674
13612
  }
13675
13613
  /**
13614
+ * @TODO move to separated api
13676
13615
  * Deactivate activated property
13677
13616
  */
13678
13617
  deactivate(property) {
@@ -13690,18 +13629,7 @@ class PropertyService extends RestService$1 {
13690
13629
  return throwError(error);
13691
13630
  }));
13692
13631
  }
13693
- /**
13694
- * Update property photo
13695
- * @param property Property instance for photo update
13696
- * @param photoFormData FormData with property photo image
13697
- */
13698
- updatePhoto(property, photoFormData) {
13699
- return this.http.post(`${this.environment.apiV2}/properties/${property.id}/photo?_method=PUT`, photoFormData)
13700
- .pipe(map((photoLink) => {
13701
- this.updateCache([plainToClass(Property, merge(property, { photo: photoLink }))], 'put');
13702
- }));
13703
- }
13704
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13632
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13705
13633
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyService, providedIn: 'root' }); }
13706
13634
  }
13707
13635
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PropertyService, decorators: [{
@@ -13709,26 +13637,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13709
13637
  args: [{
13710
13638
  providedIn: 'root'
13711
13639
  }]
13712
- }] });
13640
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
13641
+ type: Inject,
13642
+ args: ['environment']
13643
+ }] }]; } });
13713
13644
 
13714
13645
  /**
13715
13646
  * Service to handle service notifications logic
13716
13647
  */
13717
13648
  class ServiceNotificationService extends RestService {
13718
- constructor(http, eventDispatcherService, environment, toastService, sseService) {
13719
- super(http, eventDispatcherService, environment, toastService);
13720
- this.http = http;
13649
+ constructor(eventDispatcherService, environment, toastService, sseService) {
13650
+ super(environment);
13721
13651
  this.eventDispatcherService = eventDispatcherService;
13722
13652
  this.environment = environment;
13723
13653
  this.toastService = toastService;
13724
13654
  this.sseService = sseService;
13725
13655
  this.modelClass = Notification;
13726
13656
  this.url = 'service-notifications';
13727
- this.isHydra = true;
13657
+ this.listenEvents();
13658
+ }
13659
+ listenEvents() {
13728
13660
  this.listenNotifications();
13729
13661
  }
13730
13662
  /**
13731
- * subscribe to new chat messages
13663
+ * @TODO refactor with listenSSE
13732
13664
  */
13733
13665
  listenNotifications() {
13734
13666
  this.sseService.on(`serviceNotification`).subscribe((notificationBase) => {
@@ -13757,7 +13689,7 @@ class ServiceNotificationService extends RestService {
13757
13689
  this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.NOTIFICATION_ADDED, notification));
13758
13690
  });
13759
13691
  }
13760
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServiceNotificationService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable }); }
13692
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServiceNotificationService, deps: [{ token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }, { token: SseService }], target: i0.ɵɵFactoryTarget.Injectable }); }
13761
13693
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServiceNotificationService, providedIn: 'root' }); }
13762
13694
  }
13763
13695
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServiceNotificationService, decorators: [{
@@ -13765,7 +13697,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13765
13697
  args: [{
13766
13698
  providedIn: 'root'
13767
13699
  }]
13768
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
13700
+ }], ctorParameters: function () { return [{ type: EventDispatcherService }, { type: undefined, decorators: [{
13769
13701
  type: Inject,
13770
13702
  args: ['environment']
13771
13703
  }] }, { type: ToastService }, { type: SseService }]; } });
@@ -13780,7 +13712,6 @@ class SoleBusinessService extends RestService {
13780
13712
  super(...arguments);
13781
13713
  this.modelClass = SoleBusiness;
13782
13714
  this.url = 'sole-businesses';
13783
- this.isHydra = true;
13784
13715
  }
13785
13716
  add(soleBusiness) {
13786
13717
  return super.add(soleBusiness).pipe(map((business) => {
@@ -13803,7 +13734,6 @@ class SoleBusinessActivityService extends RestService {
13803
13734
  super(...arguments);
13804
13735
  this.modelClass = SoleBusinessActivity;
13805
13736
  this.url = 'sole-business-activities';
13806
- this.isHydra = true;
13807
13737
  }
13808
13738
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessActivityService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13809
13739
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessActivityService, providedIn: 'root' }); }
@@ -13816,11 +13746,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13816
13746
  }] });
13817
13747
 
13818
13748
  class SoleBusinessLossService extends RestService {
13819
- constructor() {
13820
- super(...arguments);
13749
+ constructor(environment) {
13750
+ super(environment);
13751
+ this.environment = environment;
13821
13752
  this.modelClass = SoleBusinessLoss;
13822
13753
  this.url = 'sole-business-losses';
13823
- this.isHydra = true;
13754
+ this.listenEvents();
13824
13755
  }
13825
13756
  listenEvents() {
13826
13757
  this.listenBusinessCreated();
@@ -13833,7 +13764,7 @@ class SoleBusinessLossService extends RestService {
13833
13764
  this.refreshCache();
13834
13765
  });
13835
13766
  }
13836
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessLossService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13767
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessLossService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
13837
13768
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessLossService, providedIn: 'root' }); }
13838
13769
  }
13839
13770
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessLossService, decorators: [{
@@ -13841,7 +13772,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13841
13772
  args: [{
13842
13773
  providedIn: 'root'
13843
13774
  }]
13844
- }] });
13775
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
13776
+ type: Inject,
13777
+ args: ['environment']
13778
+ }] }]; } });
13845
13779
 
13846
13780
  /**
13847
13781
  * @TODO vik replace with json when the final list is confirmed
@@ -13851,7 +13785,6 @@ class SoleBusinessLossOffsetRuleService extends RestService {
13851
13785
  super(...arguments);
13852
13786
  this.modelClass = SoleBusinessLossOffsetRule;
13853
13787
  this.url = 'sole-business-loss-offset-rules';
13854
- this.isHydra = true;
13855
13788
  }
13856
13789
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessLossOffsetRuleService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13857
13790
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleBusinessLossOffsetRuleService, providedIn: 'root' }); }
@@ -13868,7 +13801,6 @@ class SoleContactService extends RestService {
13868
13801
  super(...arguments);
13869
13802
  this.modelClass = SoleContact;
13870
13803
  this.url = 'sole-contacts';
13871
- this.isHydra = true;
13872
13804
  }
13873
13805
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleContactService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13874
13806
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleContactService, providedIn: 'root' }); }
@@ -13899,7 +13831,7 @@ class SoleDepreciationMethodService {
13899
13831
  get() {
13900
13832
  if (!this.cache) {
13901
13833
  this.http.get(`${this.environment.apiV2}/${this.url}`)
13902
- .pipe(map((response) => plainToClass(SoleDepreciationMethod, response['hydra:member'][0])))
13834
+ .pipe(map((response) => plainToClass(SoleDepreciationMethod, response[0])))
13903
13835
  .subscribe((soleDepreciationMethod) => {
13904
13836
  this.cache = soleDepreciationMethod;
13905
13837
  this.cacheSubject.next(this.cache);
@@ -13917,7 +13849,8 @@ class SoleDepreciationMethodService {
13917
13849
  this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SOLE_DEPRECIATION_METHOD_UPDATED, method));
13918
13850
  return this.cache;
13919
13851
  }), catchError((error) => {
13920
- this.toastService.error(error.error['hydra:description']);
13852
+ // @TODO test
13853
+ this.toastService.error(error.error['detail']);
13921
13854
  return throwError(error);
13922
13855
  }));
13923
13856
  }
@@ -13954,7 +13887,7 @@ class SoleDetailsService {
13954
13887
  get() {
13955
13888
  if (!this.cache) {
13956
13889
  this.http.get(`${this.environment.apiV2}/sole-details`)
13957
- .pipe(map((response) => plainToClass(SoleDetails, response['hydra:member'][0])))
13890
+ .pipe(map((response) => plainToClass(SoleDetails, response[0])))
13958
13891
  .subscribe((soleDetails) => {
13959
13892
  // undefined when user not created sole details
13960
13893
  if (!soleDetails) {
@@ -13997,12 +13930,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
13997
13930
  }] }, { type: EventDispatcherService }]; } });
13998
13931
 
13999
13932
  class SoleInvoiceService extends RestService {
14000
- constructor() {
14001
- super(...arguments);
13933
+ constructor(environment) {
13934
+ super(environment);
13935
+ this.environment = environment;
14002
13936
  this.modelClass = SoleInvoice;
14003
13937
  this.url = 'sole-invoices';
14004
- this.isHydra = true;
14005
13938
  this.roles = [UserRolesEnum.SOLE_TANK];
13939
+ this.listenEvents();
14006
13940
  }
14007
13941
  listenEvents() {
14008
13942
  this.listenAllocations();
@@ -14059,7 +13993,7 @@ class SoleInvoiceService extends RestService {
14059
13993
  this.refreshCache();
14060
13994
  });
14061
13995
  }
14062
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
13996
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14063
13997
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceService, providedIn: 'root' }); }
14064
13998
  }
14065
13999
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceService, decorators: [{
@@ -14067,14 +14001,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14067
14001
  args: [{
14068
14002
  providedIn: 'root'
14069
14003
  }]
14070
- }] });
14004
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
14005
+ type: Inject,
14006
+ args: ['environment']
14007
+ }] }]; } });
14071
14008
 
14072
14009
  class SoleInvoiceTemplateService extends RestService {
14073
14010
  constructor() {
14074
14011
  super(...arguments);
14075
14012
  this.modelClass = SoleInvoiceTemplate;
14076
14013
  this.url = 'sole-invoice-templates';
14077
- this.isHydra = true;
14078
14014
  }
14079
14015
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceTemplateService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14080
14016
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceTemplateService, providedIn: 'root' }); }
@@ -14091,7 +14027,6 @@ class BasReportService extends RestService {
14091
14027
  super(...arguments);
14092
14028
  this.modelClass = BasReport;
14093
14029
  this.url = 'bas-reports';
14094
- this.isHydra = true;
14095
14030
  }
14096
14031
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BasReportService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14097
14032
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BasReportService, providedIn: 'root' }); }
@@ -14106,7 +14041,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14106
14041
  class ServicePaymentService extends RestService$1 {
14107
14042
  constructor() {
14108
14043
  super(...arguments);
14109
- this.isApiPlatform = true;
14110
14044
  this.endpointUri = 'service-payments';
14111
14045
  this.modelClass = ServicePayment;
14112
14046
  this.collectionClass = Collection;
@@ -14132,16 +14066,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14132
14066
  }] });
14133
14067
 
14134
14068
  class ServicePaymentMethodService extends RestService$1 {
14135
- constructor(http, eventDispatcherService, environment) {
14136
- super(http, eventDispatcherService, environment);
14137
- this.http = http;
14138
- this.eventDispatcherService = eventDispatcherService;
14069
+ constructor(environment) {
14070
+ super(environment);
14139
14071
  this.environment = environment;
14140
14072
  this.endpointUri = 'service-payment-methods';
14141
14073
  this.collectionClass = Collection;
14142
14074
  this.modelClass = ServicePaymentMethod;
14143
- this.isApiPlatform = true;
14144
- this.listenPaymentMethods();
14075
+ this.listenEvents();
14076
+ }
14077
+ listenEvents() {
14078
+ // @TODO remove when TT-3826 is ready
14079
+ this.listenSSE();
14145
14080
  }
14146
14081
  /**
14147
14082
  * Get Stripe client secret required for Payment form initialization
@@ -14154,23 +14089,7 @@ class ServicePaymentMethodService extends RestService$1 {
14154
14089
  return this.http.put(`${this.apiUrl}/${paymentMethod.id}/default`, {})
14155
14090
  .pipe(map((updatedPaymentMethod) => plainToClass(ServicePaymentMethod, updatedPaymentMethod)));
14156
14091
  }
14157
- listenPaymentMethods() {
14158
- this.sseService.on('servicePaymentMethods').subscribe((newPaymentMethod) => {
14159
- const paymentMethodFromCache = this.cache.findBy('id', newPaymentMethod.id);
14160
- // backend send empty object when payment method deleted
14161
- if (!newPaymentMethod.id) {
14162
- return;
14163
- }
14164
- // replace cache item in cache when exist
14165
- if (paymentMethodFromCache) {
14166
- this.handleResponse([plainToClass(ServicePaymentMethod, newPaymentMethod)], 'put');
14167
- return;
14168
- }
14169
- // add a new payment method to cache
14170
- this.handleResponse([plainToClass(ServicePaymentMethod, newPaymentMethod)], 'post');
14171
- });
14172
- }
14173
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServicePaymentMethodService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14092
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServicePaymentMethodService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14174
14093
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServicePaymentMethodService, providedIn: 'root' }); }
14175
14094
  }
14176
14095
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServicePaymentMethodService, decorators: [{
@@ -14178,7 +14097,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14178
14097
  args: [{
14179
14098
  providedIn: 'root'
14180
14099
  }]
14181
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
14100
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
14182
14101
  type: Inject,
14183
14102
  args: ['environment']
14184
14103
  }] }]; } });
@@ -14191,7 +14110,6 @@ class ServicePriceService extends RestService$1 {
14191
14110
  super(...arguments);
14192
14111
  this.endpointUri = 'service-prices';
14193
14112
  this.modelClass = ServicePrice;
14194
- this.isApiPlatform = true;
14195
14113
  this.collectionClass = ServicePriceCollection;
14196
14114
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
14197
14115
  }
@@ -14219,17 +14137,19 @@ var SubscriptionMessagesEnum;
14219
14137
  * @TODO Alex refactor
14220
14138
  */
14221
14139
  class SubscriptionService extends RestService$1 {
14222
- constructor(http, eventDispatcherService, environment) {
14223
- super(http, eventDispatcherService, environment);
14140
+ constructor(http, environment) {
14141
+ super(environment);
14224
14142
  this.http = http;
14225
- this.eventDispatcherService = eventDispatcherService;
14226
14143
  this.environment = environment;
14227
- this.isApiPlatform = true;
14228
14144
  this.endpointUri = 'service-subscriptions';
14229
14145
  this.modelClass = ServiceSubscription;
14230
14146
  this.collectionClass = ServiceSubscriptionCollection;
14231
14147
  this.disabledMethods = ['putBatch', 'delete', 'deleteBatch'];
14232
- this.listenSubscriptions();
14148
+ this.mercureTopic = 'serviceSubscriptions';
14149
+ this.listenEvents();
14150
+ }
14151
+ listenEvents() {
14152
+ this.listenSSE();
14233
14153
  }
14234
14154
  startTrial(subscription) {
14235
14155
  return this.http.post(`${this.apiUrl}/trial`, subscription)
@@ -14279,25 +14199,7 @@ class SubscriptionService extends RestService$1 {
14279
14199
  params: { code }
14280
14200
  }).pipe(map((response) => plainToClass(ServicePromoCode, response)));
14281
14201
  }
14282
- listenSubscriptions() {
14283
- this.sseService.on(`serviceSubscriptions`)
14284
- .subscribe((serviceSubscription) => {
14285
- const subscription = plainToClass(ServiceSubscription, serviceSubscription);
14286
- // update existing message if read and add new message if not read
14287
- if (this.cache.findBy('id', subscription.id)) {
14288
- this.handleResponse([subscription], 'put');
14289
- }
14290
- else {
14291
- this.handleResponse([subscription], 'post');
14292
- }
14293
- // @TODO vik test and remove
14294
- setTimeout(() => {
14295
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED, null));
14296
- this.toastService.success('Subscription successfully updated!!!');
14297
- }, 2000);
14298
- });
14299
- }
14300
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubscriptionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14202
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubscriptionService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14301
14203
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubscriptionService, providedIn: 'root' }); }
14302
14204
  }
14303
14205
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SubscriptionService, decorators: [{
@@ -14305,7 +14207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14305
14207
  args: [{
14306
14208
  providedIn: 'root'
14307
14209
  }]
14308
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
14210
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
14309
14211
  type: Inject,
14310
14212
  args: ['environment']
14311
14213
  }] }]; } });
@@ -14317,7 +14219,6 @@ class ServiceProductService extends RestService$1 {
14317
14219
  this.modelClass = ServiceProduct;
14318
14220
  this.endpointUri = 'service-products';
14319
14221
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
14320
- this.isApiPlatform = true;
14321
14222
  }
14322
14223
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServiceProductService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14323
14224
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ServiceProductService, providedIn: 'root' }); }
@@ -14427,10 +14328,12 @@ __decorate([
14427
14328
  * Service to work with tax review history
14428
14329
  */
14429
14330
  class TaxReviewHistoryService extends RestService {
14430
- constructor() {
14431
- super(...arguments);
14331
+ constructor(environment) {
14332
+ super(environment);
14333
+ this.environment = environment;
14432
14334
  this.url = 'tax-reviews/history';
14433
14335
  this.modelClass = TaxReview;
14336
+ this.listenEvents();
14434
14337
  }
14435
14338
  listenEvents() {
14436
14339
  this.listenTaxReviewUpdate();
@@ -14447,7 +14350,7 @@ class TaxReviewHistoryService extends RestService {
14447
14350
  this.updateCache();
14448
14351
  });
14449
14352
  }
14450
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewHistoryService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14353
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewHistoryService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14451
14354
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewHistoryService, providedIn: 'root' }); }
14452
14355
  }
14453
14356
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewHistoryService, decorators: [{
@@ -14455,16 +14358,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14455
14358
  args: [{
14456
14359
  providedIn: 'root'
14457
14360
  }]
14458
- }] });
14361
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
14362
+ type: Inject,
14363
+ args: ['environment']
14364
+ }] }]; } });
14459
14365
 
14460
14366
  /**
14461
14367
  * Service to work with tax review
14462
14368
  */
14463
14369
  class TaxReviewService extends RestService {
14464
- constructor() {
14465
- super(...arguments);
14370
+ constructor(environment) {
14371
+ super(environment);
14372
+ this.environment = environment;
14466
14373
  this.url = 'tax-reviews';
14467
14374
  this.modelClass = TaxReview;
14375
+ this.listenEvents();
14468
14376
  }
14469
14377
  /**
14470
14378
  * Listen events from SSE and Event Dispatcher services
@@ -14538,7 +14446,7 @@ class TaxReviewService extends RestService {
14538
14446
  }
14539
14447
  });
14540
14448
  }
14541
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14449
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14542
14450
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewService, providedIn: 'root' }); }
14543
14451
  }
14544
14452
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TaxReviewService, decorators: [{
@@ -14546,7 +14454,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14546
14454
  args: [{
14547
14455
  providedIn: 'root'
14548
14456
  }]
14549
- }] });
14457
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
14458
+ type: Inject,
14459
+ args: ['environment']
14460
+ }] }]; } });
14550
14461
 
14551
14462
  var TaxReviewMessagesEnum;
14552
14463
  (function (TaxReviewMessagesEnum) {
@@ -14850,7 +14761,6 @@ class AllocationRuleService extends RestService$1 {
14850
14761
  this.endpointUri = 'allocation-rules';
14851
14762
  this.collectionClass = AllocationRuleCollection;
14852
14763
  this.modelClass = AllocationRule;
14853
- this.isApiPlatform = true;
14854
14764
  }
14855
14765
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AllocationRuleService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14856
14766
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AllocationRuleService, providedIn: 'root' }); }
@@ -14866,11 +14776,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14866
14776
  * @TODO move to new rest
14867
14777
  */
14868
14778
  class TransactionAllocationService extends RestService {
14869
- constructor() {
14870
- super(...arguments);
14779
+ constructor(environment) {
14780
+ super(environment);
14781
+ this.environment = environment;
14871
14782
  // API URL param for transaction allocations
14872
14783
  this.url = 'transaction-allocations';
14873
14784
  this.modelClass = TransactionAllocation;
14785
+ this.listenEvents();
14874
14786
  }
14875
14787
  /**
14876
14788
  * Add single transaction allocation
@@ -14942,7 +14854,7 @@ class TransactionAllocationService extends RestService {
14942
14854
  this.refreshCache();
14943
14855
  });
14944
14856
  }
14945
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionAllocationService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
14857
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionAllocationService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14946
14858
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionAllocationService, providedIn: 'root' }); }
14947
14859
  }
14948
14860
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionAllocationService, decorators: [{
@@ -14950,22 +14862,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
14950
14862
  args: [{
14951
14863
  providedIn: 'root'
14952
14864
  }]
14953
- }] });
14865
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
14866
+ type: Inject,
14867
+ args: ['environment']
14868
+ }] }]; } });
14954
14869
 
14955
14870
  /**
14956
14871
  * Service for transactions business logic
14957
14872
  */
14958
14873
  class TransactionService extends RestService {
14959
- constructor(http, eventDispatcherService, environment, toastService) {
14960
- super(http, eventDispatcherService, environment, toastService);
14874
+ constructor(http, eventDispatcherService, environment) {
14875
+ super(environment);
14961
14876
  this.http = http;
14962
14877
  this.eventDispatcherService = eventDispatcherService;
14963
14878
  this.environment = environment;
14964
- this.toastService = toastService;
14965
14879
  // url part for Transaction API
14966
14880
  this.url = 'transactions';
14967
14881
  this.modelClass = Transaction;
14968
14882
  this.transactionDeleted = new EventEmitter();
14883
+ this.listenEvents();
14969
14884
  }
14970
14885
  /**
14971
14886
  * Listen events from Event Dispatcher services
@@ -15197,7 +15112,7 @@ class TransactionService extends RestService {
15197
15112
  this.refreshCache();
15198
15113
  });
15199
15114
  }
15200
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }, { token: ToastService }], target: i0.ɵɵFactoryTarget.Injectable }); }
15115
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
15201
15116
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionService, providedIn: 'root' }); }
15202
15117
  }
15203
15118
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionService, decorators: [{
@@ -15208,7 +15123,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
15208
15123
  }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: EventDispatcherService }, { type: undefined, decorators: [{
15209
15124
  type: Inject,
15210
15125
  args: ['environment']
15211
- }] }, { type: ToastService }]; } });
15126
+ }] }]; } });
15212
15127
 
15213
15128
  // @TODO Artem: implement cache and extend rest?
15214
15129
  class TutorialVideoService {
@@ -15323,7 +15238,7 @@ class VehicleClaimDetailsService {
15323
15238
  get() {
15324
15239
  if (!this.cache) {
15325
15240
  this.http.get(`${this.environment.apiV2}/${this.url}`)
15326
- .pipe(map((response) => plainToClass(VehicleClaimDetails, response['hydra:member'][0], { excludePrefixes: ['@'] })))
15241
+ .pipe(map((response) => plainToClass(VehicleClaimDetails, response[0])))
15327
15242
  .subscribe((vehicleClaimDetails) => {
15328
15243
  this.cache = vehicleClaimDetails;
15329
15244
  this.cacheSubject.next(this.cache);
@@ -15342,7 +15257,7 @@ class VehicleClaimDetailsService {
15342
15257
  }
15343
15258
  update(details) {
15344
15259
  return this.http.put(`${this.environment.apiV2}/${this.url}/${details.id}`, details).pipe(map((updatedDetails) => {
15345
- const details = plainToClass(VehicleClaimDetails, updatedDetails, { excludePrefixes: ['@'] });
15260
+ const details = plainToClass(VehicleClaimDetails, updatedDetails);
15346
15261
  this.cache = details;
15347
15262
  this.cacheSubject.next(details);
15348
15263
  this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.VEHICLE_CLAIM_DETAILS_UPDATED, details));
@@ -15408,7 +15323,6 @@ class AnnualClientDetailsService extends RestService$1 {
15408
15323
  this.modelClass = AnnualClientDetails;
15409
15324
  this.collectionClass = Collection;
15410
15325
  this.endpointUri = 'annual-client-details';
15411
- this.isApiPlatform = true;
15412
15326
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch', 'delete'];
15413
15327
  }
15414
15328
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnualClientDetailsService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -15507,7 +15421,6 @@ class UserEventSettingService extends RestService$1 {
15507
15421
  this.modelClass = UserEventSetting;
15508
15422
  this.collectionClass = UserEventSettingCollection;
15509
15423
  this.endpointUri = 'user-event-settings';
15510
- this.isApiPlatform = true;
15511
15424
  this.disabledMethods = ['postBatch', 'putBatch', 'delete', 'deleteBatch'];
15512
15425
  }
15513
15426
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserEventSettingService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -15526,7 +15439,6 @@ class UserEventTypeService extends RestService$1 {
15526
15439
  this.modelClass = UserEventType;
15527
15440
  this.collectionClass = UserEventTypeCollection;
15528
15441
  this.endpointUri = 'user-event-types';
15529
- this.isApiPlatform = true;
15530
15442
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
15531
15443
  }
15532
15444
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserEventTypeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -15566,17 +15478,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
15566
15478
  }] });
15567
15479
 
15568
15480
  class UserService extends RestService$1 {
15569
- constructor() {
15570
- super(...arguments);
15481
+ constructor(environment) {
15482
+ super(environment);
15483
+ this.environment = environment;
15571
15484
  this.modelClass = User;
15572
15485
  this.collectionClass = Collection;
15573
15486
  this.endpointUri = 'users';
15574
- this.isApiPlatform = false;
15575
15487
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch', 'delete'];
15488
+ this.listenEvents();
15576
15489
  }
15577
15490
  listenEvents() {
15578
15491
  this.listenServiceSubscriptionUpdated();
15579
- this.listenBasiqConsentUpdated();
15580
15492
  }
15581
15493
  fetch() {
15582
15494
  return super.fetch(`${this.apiUrl}/current`).pipe(map((users) => {
@@ -15673,15 +15585,15 @@ class UserService extends RestService$1 {
15673
15585
  * Update cache when user's service subscription is updated
15674
15586
  */
15675
15587
  listenServiceSubscriptionUpdated() {
15676
- this.eventDispatcherService.on(AppEventTypeEnum.SERVICE_SUBSCRIPTION_UPDATED).subscribe(() => this.refreshCache());
15677
- }
15678
- /**
15679
- * Update cache when user's basiq consent flag is updated
15680
- */
15681
- listenBasiqConsentUpdated() {
15682
- this.eventDispatcherService.on(AppEventTypeEnum.BASIQ_CONSENT_UPDATED).subscribe(() => this.refreshCache());
15588
+ this.listenCSE(ServiceSubscription, () => {
15589
+ // @TODO vik test and remove
15590
+ setTimeout(() => {
15591
+ this.refreshCache();
15592
+ this.toastService.success('Subscription successfully updated');
15593
+ }, 2000);
15594
+ }, ['post', 'put']);
15683
15595
  }
15684
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
15596
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
15685
15597
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserService, providedIn: 'root' }); }
15686
15598
  }
15687
15599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UserService, decorators: [{
@@ -15689,7 +15601,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
15689
15601
  args: [{
15690
15602
  providedIn: 'root'
15691
15603
  }]
15692
- }] });
15604
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
15605
+ type: Inject,
15606
+ args: ['environment']
15607
+ }] }]; } });
15693
15608
 
15694
15609
  class FinancialYearService {
15695
15610
  constructor(http, environment, mpService) {
@@ -15718,19 +15633,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
15718
15633
  }] }, { type: MixpanelService }]; } });
15719
15634
 
15720
15635
  class HoldingService extends RestService$1 {
15721
- constructor() {
15722
- super(...arguments);
15636
+ constructor(environment) {
15637
+ super(environment);
15638
+ this.environment = environment;
15723
15639
  this.modelClass = Holding;
15724
15640
  this.collectionClass = HoldingCollection;
15725
15641
  this.endpointUri = 'holdings';
15726
- this.isApiPlatform = true;
15727
15642
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
15728
15643
  this.roles = [UserRolesEnum.HOLDING_TANK];
15644
+ this.listenEvents();
15729
15645
  }
15730
15646
  listenEvents() {
15731
- this.listenCSE(HoldingSale, ['post', 'put', 'delete'], this.refreshCache);
15647
+ this.listenCSE(HoldingSale, this.refreshCache, ['post', 'put', 'delete']);
15732
15648
  }
15733
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HoldingService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
15649
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HoldingService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
15734
15650
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HoldingService, providedIn: 'root' }); }
15735
15651
  }
15736
15652
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HoldingService, decorators: [{
@@ -15738,7 +15654,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
15738
15654
  args: [{
15739
15655
  providedIn: 'root'
15740
15656
  }]
15741
- }] });
15657
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
15658
+ type: Inject,
15659
+ args: ['environment']
15660
+ }] }]; } });
15742
15661
 
15743
15662
  class HoldingTypeService extends RestService$1 {
15744
15663
  constructor() {
@@ -15746,7 +15665,6 @@ class HoldingTypeService extends RestService$1 {
15746
15665
  this.modelClass = HoldingType;
15747
15666
  this.collectionClass = HoldingTypeCollection;
15748
15667
  this.endpointUri = 'holding-types';
15749
- this.isApiPlatform = true;
15750
15668
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
15751
15669
  }
15752
15670
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HoldingTypeService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -15765,7 +15683,6 @@ class HoldingSaleService extends RestService$1 {
15765
15683
  this.modelClass = HoldingSale;
15766
15684
  this.collectionClass = HoldingSaleCollection;
15767
15685
  this.endpointUri = 'holding-sales';
15768
- this.isApiPlatform = true;
15769
15686
  this.disabledMethods = ['postBatch', 'putBatch', 'deleteBatch'];
15770
15687
  }
15771
15688
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HoldingSaleService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -18107,7 +18024,6 @@ class SetupItemService extends RestService$1 {
18107
18024
  constructor() {
18108
18025
  super(...arguments);
18109
18026
  this.endpointUri = 'setup-items';
18110
- this.isApiPlatform = true;
18111
18027
  this.modelClass = AccountSetupItem;
18112
18028
  this.collectionClass = AccountSetupItemCollection;
18113
18029
  this.disabledMethods = ['post', 'postBatch', 'put', 'putBatch', 'delete', 'deleteBatch'];
@@ -18963,7 +18879,6 @@ class PropertyCalculationService {
18963
18879
  ]).pipe(map(([properties, bankAccounts, loans]) => this.getLvrCommencement(properties, loans, bankAccounts)));
18964
18880
  }
18965
18881
  getLvrGrowth(properties, bankAccounts, loans) {
18966
- const lvr = this.getLvr(properties, bankAccounts);
18967
18882
  const lvrCommencement = this.getLvrCommencement(properties, loans, bankAccounts);
18968
18883
  if (!lvrCommencement) {
18969
18884
  // check if lvrCommencement = 0 to avoid division by zero
@@ -19454,7 +19369,6 @@ class Endpoint {
19454
19369
  * @TODO Alex/Vik: Create some smart system for preloader endpoints.
19455
19370
  */
19456
19371
  const ENDPOINTS = {
19457
- ASSETS_GET: new Endpoint('GET', '\\/assets\\/\.\*\\/\\d+'),
19458
19372
  ALLOCATION_RULES_GET: new Endpoint('GET', '\\/allocation-rules'),
19459
19373
  ALLOCATION_RULES_POST: new Endpoint('POST', '\\/allocation-rules'),
19460
19374
  ALLOCATION_RULES_PUT: new Endpoint('PUT', '\\/allocation-rules\\/\\d+'),
@@ -19499,7 +19413,7 @@ const ENDPOINTS = {
19499
19413
  ANNUAL_CLIENT_DETAILS_POST: new Endpoint('POST', '\\/annual-client-details'),
19500
19414
  ANNUAL_CLIENT_DETAILS_PUT: new Endpoint('PUT', '\\/annual-client-details\\/\\d+'),
19501
19415
  ANNUAL_CLIENT_DETAILS_DELETE: new Endpoint('DELETE', '\\/annual-client-details\\/\\d+'),
19502
- DEPRECIATIONS_OPENING_GET: new Endpoint('GET', '\\/depreciations\\/\\opening-balance\.\*'),
19416
+ DEPRECIATIONS_OPENING_POST: new Endpoint('GET', '\\/depreciations\\/\\opening-balance'),
19503
19417
  DEPRECIATIONS_GET: new Endpoint('GET', '\\/depreciations'),
19504
19418
  DEPRECIATIONS_POST: new Endpoint('POST', '\\/depreciations'),
19505
19419
  DEPRECIATIONS_PUT: new Endpoint('PUT', '\\/depreciations\\/\\d+'),
@@ -19517,7 +19431,7 @@ const ENDPOINTS = {
19517
19431
  FILE_POST: new Endpoint('POST', '\\/api\\/files'),
19518
19432
  FIRM_GET: new Endpoint('GET', '\\/firms'),
19519
19433
  FIRM_CURRENT_GET: new Endpoint('GET', '\\/firms\\/current'),
19520
- FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current\.\*'),
19434
+ FIRM_CURRENT_PUT: new Endpoint('PUT', '\\/firms\\/current'),
19521
19435
  FIRM_INVITE_POST: new Endpoint('POST', '\\/firms\\/invite'),
19522
19436
  FIRM_REGISTRATION_POST: new Endpoint('POST', '\\/firms\\/registration'),
19523
19437
  FOLDERS_GET: new Endpoint('GET', '\\/folders'),
@@ -19570,9 +19484,9 @@ const ENDPOINTS = {
19570
19484
  PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
19571
19485
  PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
19572
19486
  PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
19573
- PROPERTIES_CATEGORIES_MOVEMENTS_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/category-movements'),
19574
- PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
19575
- PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
19487
+ PROPERTIES_CATEGORIES_MOVEMENTS_GET: new Endpoint('GET', '\\/property-category-movements'),
19488
+ PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/property-category-movements'),
19489
+ PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/property-category-movements\\/\\d+'),
19576
19490
  PROPERTIES_SHARES_PUT: new Endpoint('PUT', '\\/properties\\/shares\\/\\d+'),
19577
19491
  PROPERTIES_SHARES_GET: new Endpoint('GET', '\\/properties\\/shares'),
19578
19492
  PROPERTIES_SHARES_POST: new Endpoint('POST', '\\/properties\\/shares'),
@@ -19585,10 +19499,8 @@ const ENDPOINTS = {
19585
19499
  PROPERTIES_DOCUMENTS_POST: new Endpoint('POST', '\\/property-documents'),
19586
19500
  PROPERTIES_DOCUMENTS_PUT: new Endpoint('PUT', '\\/property-documents\\/\\d+'),
19587
19501
  PROPERTIES_DOCUMENTS_DELETE: new Endpoint('DELETE', '\\/property-documents\\/\\d+'),
19588
- PROPERTIES_PHOTO_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/photo\.\*'),
19589
19502
  PROPERTIES_SALES_GET: new Endpoint('GET', '\\/properties\\/sales'),
19590
19503
  PROPERTIES_SUGGESTIONS_GET: new Endpoint('GET', '/property\\/\\w+\\/v2\\/.*$'),
19591
- PROPERTIES_VALUATIONS_DOCUMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/valuations\\/\\d+\\/documents'),
19592
19504
  BORROWING_REPORTS_GET: new Endpoint('GET', '\\/borrowing-reports'),
19593
19505
  BORROWING_REPORTS_POST: new Endpoint('POST', '\\/borrowing-reports'),
19594
19506
  BORROWING_REPORTS_PUT: new Endpoint('PUT', '\\/borrowing-reports/\\d+'),
@@ -19659,7 +19571,7 @@ const ENDPOINTS = {
19659
19571
  USER_CONFIRMATION_POST: new Endpoint('POST', '\\/users\\/confirmation'),
19660
19572
  USER_CONFIRMATION_RESEND_POST: new Endpoint('POST', '\\/users\\/confirmation\\/resend'),
19661
19573
  USER_CURRENT_GET: new Endpoint('GET', '\\/users\\/current'),
19662
- USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/password\\/change'),
19574
+ USER_CURRENT_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/password\\/change'),
19663
19575
  USER_EVENT_SETTINGS_GET: new Endpoint('GET', '\\/user-event-settings'),
19664
19576
  USER_EVENT_TYPES_GET: new Endpoint('GET', '\\/user-event-types'),
19665
19577
  USER_INVITE_DELETE: new Endpoint('DELETE', '\\/users\\/invite\\/\\d+'),
@@ -19667,8 +19579,9 @@ const ENDPOINTS = {
19667
19579
  USER_INVITE_RESEND_POST: new Endpoint('POST', '\\/users\\/invite/\\d+\\/resend'),
19668
19580
  USER_PUT: new Endpoint('PUT', '\\/users\\/\\d+'),
19669
19581
  USER_REGISTRATION_POST: new Endpoint('POST', '\\/users\\/registration'),
19670
- USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search\.\*'),
19671
- USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo\.\*'),
19582
+ USER_RESET_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/password\\/reset'),
19583
+ USER_SEARCH_GET: new Endpoint('GET', '\\/users\\/search'),
19584
+ USER_UPDATE_PHOTO_POST: new Endpoint('POST', '\\/users\\/photo'),
19672
19585
  USER_STATUS_PUT: new Endpoint('PUT', '\\/users\\/status'),
19673
19586
  USER_RECOVERY_PASSWORD_PUT: new Endpoint('PUT', '\\/users\\/password\\/recovery'),
19674
19587
  USER_PASSWORD_RESET_PUT: new Endpoint('PUT', '\\/password\\/reset'),
@@ -22074,13 +21987,13 @@ class PropertyDocumentForm extends AbstractForm {
22074
21987
  }
22075
21988
 
22076
21989
  class PropertyValuationForm extends AbstractForm {
22077
- constructor(valuation) {
21990
+ constructor(valuation = plainToClass(PropertyValuation, {})) {
22078
21991
  super({
22079
21992
  date: new UntypedFormControl(valuation.date || new Date(), Validators.required),
22080
21993
  marketValue: new UntypedFormControl(valuation.marketValue, Validators.required),
22081
21994
  document: new UntypedFormGroup({
22082
21995
  file: new UntypedFormControl(valuation.document?.file)
22083
- })
21996
+ }),
22084
21997
  }, valuation);
22085
21998
  }
22086
21999
  submit() {
@@ -22088,6 +22001,120 @@ class PropertyValuationForm extends AbstractForm {
22088
22001
  }
22089
22002
  }
22090
22003
 
22004
+ class PropertyCategoryMovementForm extends AbstractForm {
22005
+ constructor(movement = plainToClass(PropertyCategoryMovement, {})) {
22006
+ super({
22007
+ fromDate: new UntypedFormControl(movement.valuation?.date || new Date()),
22008
+ propertyCategory: new UntypedFormControl(movement.propertyCategory, Validators.required),
22009
+ valuation: new PropertyValuationForm(movement.valuation),
22010
+ }, movement);
22011
+ this.get('valuation').get('date').valueChanges.subscribe((value) => {
22012
+ this.get('fromDate').setValue(value);
22013
+ console.log(this.get('fromDate').value);
22014
+ });
22015
+ }
22016
+ submit() {
22017
+ return super.submit({ valuation: this.get('valuation').submit() });
22018
+ }
22019
+ }
22020
+
22021
+ /**
22022
+ * Class describes property share form fields and form logic
22023
+ */
22024
+ class PropertyShareForm extends AbstractForm {
22025
+ constructor(share = plainToClass(PropertyShare, {})) {
22026
+ super({
22027
+ fromDate: new UntypedFormControl(share.fromDate || new Date()),
22028
+ percent: new UntypedFormControl(share.percent, [Validators.required, Validators.min(0), Validators.max(100)])
22029
+ }, share);
22030
+ }
22031
+ }
22032
+
22033
+ /**
22034
+ * Class describes property forecast form fields and form logic
22035
+ */
22036
+ class PropertyForecastForm extends AbstractForm {
22037
+ /**
22038
+ * @param forecast
22039
+ * @param movements property could have multiple categories within forecast year, based on categories we hide/show some fields
22040
+ */
22041
+ constructor(forecast = plainToClass(PropertyForecast, {}), movements = new PropertyCategoryMovementCollection()) {
22042
+ const noIncomeCategories = [PropertyCategoryListEnum.VACANT_LAND, PropertyCategoryListEnum.OWNER_OCCUPIED];
22043
+ const noIncome = movements.filterBy('propertyCategory.id', noIncomeCategories).length === movements.length;
22044
+ super({
22045
+ financialYear: new UntypedFormControl({ value: forecast.financialYear, disabled: true }),
22046
+ marketValue: new UntypedFormControl(forecast.marketValue, Validators.required),
22047
+ income: new UntypedFormControl({ value: forecast.income, disabled: noIncome }, Validators.required),
22048
+ expense: new UntypedFormControl(forecast.expense, Validators.required),
22049
+ interest: new UntypedFormControl(forecast.interest, Validators.required),
22050
+ depreciation: new UntypedFormControl({ value: forecast.depreciation, disabled: noIncome }, Validators.required),
22051
+ claimPercent: new UntypedFormControl({ value: forecast.claimPercent, disabled: !movements.hasCategory(PropertyCategoryListEnum.SHARED) }, [Validators.min(0), Validators.max(100), Validators.required])
22052
+ }, forecast);
22053
+ }
22054
+ }
22055
+
22056
+ /**
22057
+ * Form class for the single new property
22058
+ */
22059
+ class PropertyAddForm extends AbstractForm {
22060
+ constructor() {
22061
+ super({
22062
+ address: new UntypedFormControl(null, Validators.required),
22063
+ purchasePrice: new UntypedFormControl(null, Validators.required),
22064
+ contractDate: new UntypedFormControl(null, Validators.required),
22065
+ settlementDate: new UntypedFormControl(null, Validators.required),
22066
+ forecasts: new UntypedFormArray([
22067
+ new PropertyForecastForm()
22068
+ ]),
22069
+ shares: new UntypedFormArray([
22070
+ new PropertyShareForm()
22071
+ ]),
22072
+ categoryMovements: new UntypedFormArray([
22073
+ new PropertyCategoryMovementForm()
22074
+ ])
22075
+ }, plainToClass(Property, {}));
22076
+ // @TODO move to submit, no need to watch
22077
+ // we should put the same market value to both, forecast and valuation.
22078
+ this.valuationForm.get('marketValue').valueChanges.subscribe((marketValue) => {
22079
+ this.forecastForm.get('marketValue').setValue(marketValue);
22080
+ });
22081
+ this.get('contractDate').valueChanges.subscribe((contractDate) => {
22082
+ this.categoryMovementForm.get('fromDate').setValue(contractDate);
22083
+ });
22084
+ this.categoryMovementForm.get('propertyCategory').valueChanges.subscribe((category) => {
22085
+ if (category.isShared()) {
22086
+ this.forecastForm.get('claimPercent').enable();
22087
+ }
22088
+ else {
22089
+ this.forecastForm.get('claimPercent').disable();
22090
+ }
22091
+ if (category.isOwnerOccupied() || category.isVacantLand()) {
22092
+ this.forecastForm.get('income').disable();
22093
+ this.forecastForm.get('depreciation').disable();
22094
+ }
22095
+ else {
22096
+ this.forecastForm.get('income').enable();
22097
+ this.forecastForm.get('depreciation').enable();
22098
+ }
22099
+ });
22100
+ }
22101
+ get valuationForm() {
22102
+ return this.categoryMovementForm.get('valuation');
22103
+ }
22104
+ get forecastForm() {
22105
+ // [0] because for property add form we have always 1 forecast form inside
22106
+ return this.get('forecasts').controls[0];
22107
+ }
22108
+ get shareForm() {
22109
+ // [0] because for property add form we have always 1 forecast form inside
22110
+ return this.get('shares').controls[0];
22111
+ }
22112
+ get categoryMovementForm() {
22113
+ // [0] because for property add form we always have 1 category movement form inside
22114
+ return this.get('categoryMovements').controls[0];
22115
+ }
22116
+ }
22117
+
22091
22118
  class MyTaxBusinessDetailsForm extends AbstractForm {
22092
22119
  constructor(businessDetails) {
22093
22120
  super({
@@ -23680,5 +23707,5 @@ var MessagesEnum;
23680
23707
  * Generated bundle index. Do not edit.
23681
23708
  */
23682
23709
 
23683
- export { AbstractForm, AbstractModel, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressForm, AddressService, AddressTypeEnum, AllocationGroup, AllocationGroupCollection, AllocationRule, AllocationRuleCollection, AllocationRuleConditionComparisonOperatorEnum, AllocationRuleConditionFieldEnum, AllocationRuleConditionOperatorEnum, AllocationRuleForm, AllocationRuleService, AllocationRuleTransaction, AllocationRuleTransactionMetaField, AllocationRuleTypeEnum, AlphabetColorsEnum, AnnualClientDetails, AnnualClientDetailsForm, AnnualClientDetailsService, AnnualFrequencyEnum, AppCurrencyPipe, AppEvent, AppEvent2, AppEventTypeEnum, AppFile, AssetEntityTypeEnum, AssetSale, AssetSaleCollection, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Badge, BadgeColorEnum, Bank, BankAccount, BankAccountAddManualForm, BankAccountAllocationForm, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountImportForm, BankAccountPropertiesForm, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankAccountsImportForm, BankConnection, BankConnectionMessagesEnum, BankConnectionService, BankConnectionStatusEnum, BankExternalStats, BankPopularEnum, BankProviderEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasReport, BasReportForm, BasReportService, BasiqConfig, BasiqJob, BasiqJobResponse, BasiqJobStep, BasiqMessagesEnum, BasiqService, BasiqToken, BasiqTokenService, BestVehicleLogbookCollection, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, BorrowingReport, BorrowingReportForm, BorrowingReportMessagesEnum, BorrowingReportService, Budget, BudgetForm, BudgetMessagesEnum, BudgetRule, BudgetService, BusinessTypeEnum, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CgtExemptionAndRolloverCodeEnum, ChartAccounts, ChartAccountsCategoryECollection, ChartAccountsCategoryEnum, ChartAccountsCollection, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsHoldingUntaxedIncomeListEnum, ChartAccountsInvoiceExpenseEnum, ChartAccountsKeepSign, ChartAccountsListEnum, ChartAccountsMetaField, ChartAccountsMetaFieldListEnum, ChartAccountsMetaFieldTypeEnum, ChartAccountsSalaryAdjustmentsListEnum, ChartAccountsSalaryIncludedListEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartAccountsValueService, ChartData, ChartSerie, Chat, ChatCollection, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsForm, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteCollection, ClientInviteMessages, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEDUCTION_CATEGORIES, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DeductionClothingTypeEnum, DeductionSelfEducationTypeEnum, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationForm, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpRateEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Dictionary, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderForm, DocumentFolderMessagesEnum, DocumentFolderService, DocumentForm, DocumentMessagesEnum, DocumentService, DocumentTypeEnum, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeMessagesEnum, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FacebookService, FileService, FileValidator, FinancialYear, FinancialYearService, Firm, FirmForm, FirmMessagesEnum, FirmService, FirmTypeEnum, FormValidationsEnum, GoogleService, HeaderTitleService, Holding, HoldingCollection, HoldingForm, HoldingIncomeForm, HoldingMessagesEnum, HoldingReinvest, HoldingReinvestForm, HoldingSale, HoldingSaleCollection, HoldingSaleForm, HoldingSaleMessagesEnum, HoldingSaleService, HoldingService, HoldingType, HoldingTypeCategoryEnum, HoldingTypeCollection, HoldingTypeExchange, HoldingTypeExchangeService, HoldingTypeForm, HoldingTypeMessagesEnum, HoldingTypeService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastCollection, IncomeSourceForecastService, IncomeSourceForecastTrustTypeEnum, IncomeSourceMessagesEnum, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListHoldingEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, IncomeSourceTypeService, InterceptorsModule, IntercomService, InviteStatusEnum, JsPdf, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanForm, LoanFrequencyEnum, LoanInterestTypeEnum, LoanInterestTypeLabelEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanRepaymentTypeLabelEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LoginForm, LossTypeEnum, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MessagesEnum, MixpanelService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, MyTaxBusinessDetails, MyTaxBusinessDetailsForm, MyTaxBusinessIncome, MyTaxBusinessIncomeForm, MyTaxBusinessIncomeOrLossesForm, MyTaxBusinessLosses, MyTaxBusinessLossesForm, MyTaxCgt, MyTaxCgtForm, MyTaxDeductions, MyTaxDeductionsForm, MyTaxDividends, MyTaxDividendsForm, MyTaxEstimate, MyTaxIncomeStatements, MyTaxIncomeStatementsForm, MyTaxIncomeTests, MyTaxIncomeTestsForm, MyTaxInterest, MyTaxInterestForm, MyTaxLosses, MyTaxLossesForm, MyTaxMedicareForm, MyTaxOffsets, MyTaxOffsetsForm, MyTaxOtherIncome, MyTaxOtherIncomeForm, MyTaxPartnershipsAndTrusts, MyTaxPartnershipsAndTrustsForm, MyTaxRent, MyTaxRentForm, Notification, Occupation, OccupationService, PASSWORD_REGEXPS, PasswordForm, PdfFromDataTableService, PdfFromDomElementService, PdfFromHtmlTableService, PdfFromTableService, PdfOrientationEnum, PdfSettings, Phone, PhoneForm, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementCollection, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentForm, PropertyDocumentMessagesEnum, PropertyDocumentService, PropertyEditForm, PropertyEquityChartData, PropertyEquityChartItem, PropertyEquityChartTypeEnum, PropertyForecast, PropertyMessagesEnum, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciation, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleCollection, PropertySaleCostBase, PropertySaleCostBaseForm, PropertySaleCostSaleForm, PropertySaleExemptionsForm, PropertySaleService, PropertySaleTaxExemptionMetaField, PropertySaleTaxExemptionMetaFieldCollection, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareCollection, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, PropertyValuationForm, PropertyValuationMessages, PropertyValuationService, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, RestService$1 as RestService, RewardfulService, SERVICE_PRODUCT_ROLES, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentMethod, ServicePaymentMethodService, ServicePaymentService, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductCollection, ServiceProductIconsEnum, ServiceProductIdEnum, ServiceProductService, ServiceProductStatusEnum, ServicePromoCode, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SetupItemTypeEnum, ShareFilterOptionsEnum, SoleBusiness, SoleBusinessActivity, SoleBusinessActivityService, SoleBusinessAllocation, SoleBusinessAllocationsForm, SoleBusinessForm, SoleBusinessLoss, SoleBusinessLossForm, SoleBusinessLossOffsetRule, SoleBusinessLossOffsetRuleService, SoleBusinessLossReport, SoleBusinessLossService, SoleBusinessLossesCollection, SoleBusinessMessagesEnum, SoleBusinessService, SoleContact, SoleContactForm, SoleContactService, SoleDepreciationMethod, SoleDepreciationMethodEnum, SoleDepreciationMethodForm, SoleDepreciationMethodService, SoleDetails, SoleDetailsForm, SoleDetailsService, SoleForecast, SoleForecastService, SoleIncomeForm, SoleInvoice, SoleInvoiceCollection, SoleInvoiceForm, SoleInvoiceItem, SoleInvoiceItemCollection, SoleInvoiceItemForm, SoleInvoiceService, SoleInvoiceStatusesEnum, SoleInvoiceTaxTypeEnum, SoleInvoiceTemplate, SoleInvoiceTemplateForm, SoleInvoiceTemplateService, SoleInvoiceTemplateTaxTypeEnum, SpareDocumentSpareTypeEnum, SseService, StatesEnum, SubscriptionItemCollection, SubscriptionMessagesEnum, SubscriptionService, TAX_RETURN_CATEGORIES, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetaField, TaxExemptionMetaFieldEnum, TaxExemptionService, TaxReturn, TaxReturnCategory, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReturnItem, TaxReturnItemEnum, TaxReturnItemService, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewMessagesEnum, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionBaseForm, TransactionCalculationService, TransactionCategoryEnum, TransactionCollection, TransactionForm, TransactionMetaField, TransactionOperationEnum, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, TutorialVideoService, USER_ROLES, USER_WORK_POSITION, UniqueEmailValidator, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeCollection, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserForm, UserInviteForm, UserMedicareExemptionEnum, UserMessagesEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, UsersInviteService, Vehicle, VehicleClaim, VehicleClaimCollection, VehicleClaimDetails, VehicleClaimDetailsForm, VehicleClaimDetailsMethodEnum, VehicleClaimDetailsService, VehicleClaimForm, VehicleClaimService, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookForm, VehicleLogbookMessages, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleMessagesEnum, VehicleService, WorkExpenseForm, WorkIncomeForm, XlsxService, atLeastOneCheckedValidator, atoLinks, autocompleteValidator, cloneDeep, compare, compareMatOptions, conditionalValidator, createDate, currentFinYearValidator, displayMatOptions, enumToList, fieldsSumValidator, getDocIcon, greaterThanValidator, minDateValidator, passwordMatchValidator, passwordValidator, replace, sort, sortDeep, taxReviewFilterPredicate, toArray };
23710
+ export { AbstractForm, AbstractModel, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressForm, AddressService, AddressTypeEnum, AllocationGroup, AllocationGroupCollection, AllocationRule, AllocationRuleCollection, AllocationRuleConditionComparisonOperatorEnum, AllocationRuleConditionFieldEnum, AllocationRuleConditionOperatorEnum, AllocationRuleForm, AllocationRuleService, AllocationRuleTransaction, AllocationRuleTransactionMetaField, AllocationRuleTypeEnum, AlphabetColorsEnum, AnnualClientDetails, AnnualClientDetailsForm, AnnualClientDetailsService, AnnualFrequencyEnum, AppCurrencyPipe, AppEvent, AppEvent2, AppEventTypeEnum, AppFile, AssetEntityTypeEnum, AssetSale, AssetSaleCollection, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Badge, BadgeColorEnum, Bank, BankAccount, BankAccountAddManualForm, BankAccountAllocationForm, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountImportForm, BankAccountPropertiesForm, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankAccountsImportForm, BankConnection, BankConnectionMessagesEnum, BankConnectionService, BankConnectionStatusEnum, BankExternalStats, BankPopularEnum, BankProviderEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasReport, BasReportForm, BasReportService, BasiqConfig, BasiqJob, BasiqJobResponse, BasiqJobStep, BasiqMessagesEnum, BasiqService, BasiqToken, BasiqTokenService, BestVehicleLogbookCollection, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, BorrowingReport, BorrowingReportForm, BorrowingReportMessagesEnum, BorrowingReportService, Budget, BudgetForm, BudgetMessagesEnum, BudgetRule, BudgetService, BusinessTypeEnum, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CgtExemptionAndRolloverCodeEnum, ChartAccounts, ChartAccountsCategoryECollection, ChartAccountsCategoryEnum, ChartAccountsCollection, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsHoldingUntaxedIncomeListEnum, ChartAccountsInvoiceExpenseEnum, ChartAccountsKeepSign, ChartAccountsListEnum, ChartAccountsMetaField, ChartAccountsMetaFieldListEnum, ChartAccountsMetaFieldTypeEnum, ChartAccountsSalaryAdjustmentsListEnum, ChartAccountsSalaryIncludedListEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsValue, ChartAccountsValueService, ChartData, ChartSerie, Chat, ChatCollection, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsForm, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteCollection, ClientInviteMessages, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEDUCTION_CATEGORIES, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DeductionClothingTypeEnum, DeductionSelfEducationTypeEnum, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationForm, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpRateEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Dictionary, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderForm, DocumentFolderMessagesEnum, DocumentFolderService, DocumentForm, DocumentMessagesEnum, DocumentService, DocumentTypeEnum, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeMessagesEnum, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FacebookService, FileService, FileValidator, FinancialYear, FinancialYearService, Firm, FirmForm, FirmMessagesEnum, FirmService, FirmTypeEnum, FormValidationsEnum, GoogleService, HeaderTitleService, Holding, HoldingCollection, HoldingForm, HoldingIncomeForm, HoldingMessagesEnum, HoldingReinvest, HoldingReinvestForm, HoldingSale, HoldingSaleCollection, HoldingSaleForm, HoldingSaleMessagesEnum, HoldingSaleService, HoldingService, HoldingType, HoldingTypeCategoryEnum, HoldingTypeCollection, HoldingTypeExchange, HoldingTypeExchangeService, HoldingTypeForm, HoldingTypeMessagesEnum, HoldingTypeService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastCollection, IncomeSourceForecastService, IncomeSourceForecastTrustTypeEnum, IncomeSourceMessagesEnum, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListHoldingEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, IncomeSourceTypeService, InterceptorsModule, IntercomService, InviteStatusEnum, JsPdf, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanForm, LoanFrequencyEnum, LoanInterestTypeEnum, LoanInterestTypeLabelEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanRepaymentTypeLabelEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LoginForm, LossTypeEnum, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MessagesEnum, MixpanelService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, MyTaxBusinessDetails, MyTaxBusinessDetailsForm, MyTaxBusinessIncome, MyTaxBusinessIncomeForm, MyTaxBusinessIncomeOrLossesForm, MyTaxBusinessLosses, MyTaxBusinessLossesForm, MyTaxCgt, MyTaxCgtForm, MyTaxDeductions, MyTaxDeductionsForm, MyTaxDividends, MyTaxDividendsForm, MyTaxEstimate, MyTaxIncomeStatements, MyTaxIncomeStatementsForm, MyTaxIncomeTests, MyTaxIncomeTestsForm, MyTaxInterest, MyTaxInterestForm, MyTaxLosses, MyTaxLossesForm, MyTaxMedicareForm, MyTaxOffsets, MyTaxOffsetsForm, MyTaxOtherIncome, MyTaxOtherIncomeForm, MyTaxPartnershipsAndTrusts, MyTaxPartnershipsAndTrustsForm, MyTaxRent, MyTaxRentForm, Notification, Occupation, OccupationService, PASSWORD_REGEXPS, PasswordForm, PdfFromDataTableService, PdfFromDomElementService, PdfFromHtmlTableService, PdfFromTableService, PdfOrientationEnum, PdfSettings, Phone, PhoneForm, PhoneTypeEnum, PreloaderService, Property, PropertyAddForm, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementCollection, PropertyCategoryMovementForm, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentForm, PropertyDocumentMessagesEnum, PropertyDocumentService, PropertyEditForm, PropertyEquityChartData, PropertyEquityChartItem, PropertyEquityChartTypeEnum, PropertyForecast, PropertyForecastForm, PropertyMessagesEnum, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciation, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleCollection, PropertySaleCostBase, PropertySaleCostBaseForm, PropertySaleCostSaleForm, PropertySaleExemptionsForm, PropertySaleService, PropertySaleTaxExemptionMetaField, PropertySaleTaxExemptionMetaFieldCollection, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareCollection, PropertyShareForm, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, PropertyValuationCollection, PropertyValuationForm, PropertyValuationMessages, PropertyValuationService, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, RestService$1 as RestService, RewardfulService, SERVICE_PRODUCT_ROLES, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentMethod, ServicePaymentMethodService, ServicePaymentService, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductCollection, ServiceProductIconsEnum, ServiceProductIdEnum, ServiceProductService, ServiceProductStatusEnum, ServicePromoCode, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SetupItemTypeEnum, SoleBusiness, SoleBusinessActivity, SoleBusinessActivityService, SoleBusinessAllocation, SoleBusinessAllocationsForm, SoleBusinessForm, SoleBusinessLoss, SoleBusinessLossForm, SoleBusinessLossOffsetRule, SoleBusinessLossOffsetRuleService, SoleBusinessLossReport, SoleBusinessLossService, SoleBusinessLossesCollection, SoleBusinessMessagesEnum, SoleBusinessService, SoleContact, SoleContactForm, SoleContactService, SoleDepreciationMethod, SoleDepreciationMethodEnum, SoleDepreciationMethodForm, SoleDepreciationMethodService, SoleDetails, SoleDetailsForm, SoleDetailsService, SoleForecast, SoleForecastService, SoleIncomeForm, SoleInvoice, SoleInvoiceCollection, SoleInvoiceForm, SoleInvoiceItem, SoleInvoiceItemCollection, SoleInvoiceItemForm, SoleInvoiceService, SoleInvoiceStatusesEnum, SoleInvoiceTaxTypeEnum, SoleInvoiceTemplate, SoleInvoiceTemplateForm, SoleInvoiceTemplateService, SoleInvoiceTemplateTaxTypeEnum, SpareDocumentSpareTypeEnum, SseService, StatesEnum, SubscriptionItemCollection, SubscriptionMessagesEnum, SubscriptionService, TAX_RETURN_CATEGORIES, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetaField, TaxExemptionMetaFieldEnum, TaxExemptionService, TaxReturn, TaxReturnCategory, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReturnItem, TaxReturnItemEnum, TaxReturnItemService, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewMessagesEnum, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionBaseForm, TransactionCalculationService, TransactionCategoryEnum, TransactionCollection, TransactionForm, TransactionMetaField, TransactionOperationEnum, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, TutorialVideoService, USER_ROLES, USER_WORK_POSITION, UniqueEmailValidator, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeCollection, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserForm, UserInviteForm, UserMedicareExemptionEnum, UserMessagesEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, UsersInviteService, Vehicle, VehicleClaim, VehicleClaimCollection, VehicleClaimDetails, VehicleClaimDetailsForm, VehicleClaimDetailsMethodEnum, VehicleClaimDetailsService, VehicleClaimForm, VehicleClaimService, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookForm, VehicleLogbookMessages, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleMessagesEnum, VehicleService, WorkExpenseForm, WorkIncomeForm, XlsxService, atLeastOneCheckedValidator, atoLinks, autocompleteValidator, cloneDeep, compare, compareMatOptions, conditionalValidator, createDate, currentFinYearValidator, displayMatOptions, enumToList, fieldsSumValidator, getDocIcon, greaterThanValidator, minDateValidator, passwordMatchValidator, passwordValidator, replace, sort, sortDeep, taxReviewFilterPredicate, toArray };
23684
23711
  //# sourceMappingURL=taxtank-core.mjs.map