taxtank-core 0.33.41 → 0.33.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { Inject, Injectable } from '@angular/core';
2
2
  import { ReplaySubject } from 'rxjs';
3
3
  import { map } from 'rxjs/operators';
4
4
  import { plainToClass } from 'class-transformer';
5
- import { CorelogicSuggestion } from '../../../models/property/corelogic-suggestion';
5
+ import { CorelogicSuggestion } from '../../../models';
6
6
  import * as i0 from "@angular/core";
7
7
  import * as i1 from "@angular/common/http";
8
8
  export class CorelogicService {
@@ -13,7 +13,7 @@ export class CorelogicService {
13
13
  }
14
14
  getAccessToken(force = false) {
15
15
  if (!this._accessToken || force) {
16
- this.http.get(`${this.environment.coreLogicUrl}/access/oauth/token?grant_type=client_credentials&client_id=${this.environment.coreLogicId}&client_secret=${this.environment.coreLogicSecret}`)
16
+ this.http.get(`${this.environment.apiV2}/corelogic/tokens`)
17
17
  .pipe(map((response) => response.access_token))
18
18
  .subscribe((token) => {
19
19
  this._accessToken = token;
@@ -39,4 +39,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
39
39
  type: Inject,
40
40
  args: ['environment']
41
41
  }] }] });
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29yZWxvZ2ljLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90dC1jb3JlL3NyYy9saWIvc2VydmljZXMvcHJvcGVydHkvY29yZWxvZ2ljL2NvcmVsb2dpYy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRW5ELE9BQU8sRUFBYyxhQUFhLEVB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uICAgIC8vIEBUT0RPIGhhbmRsZSBkaWZmZXJlbnQgY291bnRyaWVzIGluIGZ1dHVyZVxuICAgIHJldHVybiB0aGlzLmh0dHAuZ2V0KGAke3RoaXMuZW52aXJvbm1lbnQuY29yZUxvZ2ljVXJsfS9wcm9wZXJ0eS8ke2NvdW50cnl9L3YyL3N1Z2dlc3QuanNvbj9xPSR7cXVlcnl9YClcbiAgICAgIC5waXBlKFxuICAgICAgICBtYXAoKHJlc3BvbnNlOiBhbnkpID0+IHJlc3BvbnNlLnN1Z2dlc3Rpb25zLm1hcCgoaXRlbTogb2JqZWN0KSA9PiBwbGFpblRvQ2xhc3MoQ29yZWxvZ2ljU3VnZ2VzdGlvbiwgaXRlbSkpKVxuICAgICAgKTtcbiAgfVxufVxuIl19
@@ -7,8 +7,8 @@ import { HttpParams, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http'
7
7
  import { map, mergeMap, filter, first as first$1, catchError, finalize, debounceTime, distinctUntilChanged, startWith } from 'rxjs/operators';
8
8
  import { ReplaySubject, Subject, Observable, throwError, combineLatest, BehaviorSubject, forkJoin, of, from, merge as merge$1 } from 'rxjs';
9
9
  import { plainToClass, Type, Transform, Exclude, Expose, classToPlain } from 'class-transformer';
10
- import get from 'lodash/get';
11
10
  import { __decorate } from 'tslib';
11
+ import get from 'lodash/get';
12
12
  import flatten from 'lodash/flatten';
13
13
  import hasIn from 'lodash/hasIn';
14
14
  import intersection from 'lodash/intersection';
@@ -41,124 +41,6 @@ import * as i1$2 from '@angular/platform-browser';
41
41
  import isEqual from 'lodash/isEqual';
42
42
  import { RxwebValidators } from '@rxweb/reactive-form-validators';
43
43
 
44
- /**
45
- * https://api-uat.corelogic.asia/property/au/v2/suggest.json
46
- * address suggestion from corelogic service
47
- */
48
- class CorelogicSuggestion {
49
- }
50
-
51
- class CorelogicService {
52
- constructor(http, environment) {
53
- this.http = http;
54
- this.environment = environment;
55
- this.accessTokenSubject = new ReplaySubject(1);
56
- }
57
- getAccessToken(force = false) {
58
- if (!this._accessToken || force) {
59
- this.http.get(`${this.environment.coreLogicUrl}/access/oauth/token?grant_type=client_credentials&client_id=${this.environment.coreLogicId}&client_secret=${this.environment.coreLogicSecret}`)
60
- .pipe(map((response) => response.access_token))
61
- .subscribe((token) => {
62
- this._accessToken = token;
63
- this.accessTokenSubject.next(this._accessToken);
64
- });
65
- }
66
- return this.accessTokenSubject.asObservable();
67
- }
68
- getSuggestions(query, country = 'au') {
69
- // @TODO handle different countries in future
70
- return this.http.get(`${this.environment.coreLogicUrl}/property/${country}/v2/suggest.json?q=${query}`)
71
- .pipe(map((response) => response.suggestions.map((item) => plainToClass(CorelogicSuggestion, item))));
72
- }
73
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
74
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicService, providedIn: 'root' }); }
75
- }
76
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicService, decorators: [{
77
- type: Injectable,
78
- args: [{
79
- providedIn: 'root'
80
- }]
81
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
82
- type: Inject,
83
- args: ['environment']
84
- }] }] });
85
-
86
- /**
87
- * Corelogic interceptor add Core Logic access token for each search requests related with Core Logic API
88
- */
89
- class CorelogicInterceptor {
90
- constructor(corelogicService, environment) {
91
- this.corelogicService = corelogicService;
92
- this.environment = environment;
93
- }
94
- intercept(request, next) {
95
- // skip non-corelogic requests
96
- if (!request.url.includes(this.environment.coreLogicUrl)) {
97
- return next.handle(request);
98
- }
99
- // don't need token for this endpoint
100
- if (request.url.includes(`${this.environment.coreLogicUrl}/access/oauth/token`)) {
101
- return next.handle(request);
102
- }
103
- return this.corelogicService.getAccessToken()
104
- .pipe(mergeMap((token) => next.handle(this.addToken(request, token))));
105
- }
106
- addToken(request, token) {
107
- return request.clone({
108
- setHeaders: {
109
- Authorization: 'Bearer ' + token
110
- }
111
- });
112
- }
113
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicInterceptor, deps: [{ token: CorelogicService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
114
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicInterceptor }); }
115
- }
116
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicInterceptor, decorators: [{
117
- type: Injectable
118
- }], ctorParameters: () => [{ type: CorelogicService }, { type: undefined, decorators: [{
119
- type: Inject,
120
- args: ['environment']
121
- }] }] });
122
-
123
- /**
124
- * Financial Year interceptor add financialYear parameter to requests because a lot of POST and GET requests require this parameter
125
- * @TODO now we can get current fin year from user on backend. So we can remove this interceptor
126
- */
127
- class FinancialYearInterceptor {
128
- constructor(environment) {
129
- this.environment = environment;
130
- }
131
- intercept(request, next) {
132
- // skip third party requests
133
- // @TODO Alex: Also check and ignore requests we don't need financial year
134
- if (!request.url.includes(this.environment.api_uri)) {
135
- return next.handle(request);
136
- }
137
- // Set financial year parameter to requests
138
- let params = new HttpParams({
139
- fromString: request.params.toString()
140
- });
141
- // clone request to add new parameters
142
- let clonedReq = request.clone();
143
- // @TODO query params should be passed using second param of get request and HttpParams object
144
- if (!params.get('financialYear') && !request.urlWithParams.includes('?financialYear') && !request.urlWithParams.includes('&financialYear')) {
145
- params = params.set('financialYear', localStorage.getItem('financialYear'));
146
- clonedReq = request.clone({
147
- params: params
148
- });
149
- }
150
- return next.handle(clonedReq);
151
- }
152
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FinancialYearInterceptor, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
153
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FinancialYearInterceptor }); }
154
- }
155
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FinancialYearInterceptor, decorators: [{
156
- type: Injectable
157
- }], ctorParameters: () => [{ type: undefined, decorators: [{
158
- type: Inject,
159
- args: ['environment']
160
- }] }] });
161
-
162
44
  /**
163
45
  * @TODO move from db folder when refactored base models
164
46
  */
@@ -174,6 +56,9 @@ class AbstractModel {
174
56
  }
175
57
  }
176
58
 
59
+ let Address$1 = class Address extends AbstractModel {
60
+ };
61
+
177
62
  let Country$1 = class Country extends AbstractModel {
178
63
  };
179
64
 
@@ -193,66 +78,6 @@ class Country extends Country$1 {
193
78
  }
194
79
  }
195
80
 
196
- class AddressService {
197
- constructor(http, environment) {
198
- this.http = http;
199
- this.environment = environment;
200
- this.countriesSubject = new ReplaySubject(1);
201
- }
202
- getCountries() {
203
- if (!this._countries) {
204
- this.http.get(`${this.environment.apiV2}/countries`)
205
- .pipe(map((response) => response.map((item) => plainToClass(Country, item))))
206
- .subscribe((countries) => {
207
- this._countries = countries;
208
- this.countriesSubject.next(countries);
209
- });
210
- }
211
- return this.countriesSubject.asObservable();
212
- }
213
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddressService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
214
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddressService, providedIn: 'root' }); }
215
- }
216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddressService, decorators: [{
217
- type: Injectable,
218
- args: [{
219
- providedIn: 'root'
220
- }]
221
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
222
- type: Inject,
223
- args: ['environment']
224
- }] }] });
225
-
226
- /**
227
- * @TODO TT-3846 upgrade
228
- */
229
- class PdfService {
230
- constructor(http, environment) {
231
- this.http = http;
232
- this.environment = environment;
233
- }
234
- fromHTMLElements(elements, landscape) {
235
- const formData = new FormData();
236
- formData.append('file', new Blob([...Array.from(elements).map(element => element.outerHTML)], { type: 'text/html' }));
237
- formData.append('landscape', landscape ? '1' : '0');
238
- return this.http.post(`${this.environment.apiV2}/pdf/html`, formData, { responseType: 'blob' });
239
- }
240
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PdfService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
241
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PdfService, providedIn: 'root' }); }
242
- }
243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PdfService, decorators: [{
244
- type: Injectable,
245
- args: [{
246
- providedIn: 'root'
247
- }]
248
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
249
- type: Inject,
250
- args: ['environment']
251
- }] }] });
252
-
253
- let Address$1 = class Address extends AbstractModel {
254
- };
255
-
256
81
  var AddressTypeEnum;
257
82
  (function (AddressTypeEnum) {
258
83
  AddressTypeEnum[AddressTypeEnum["STREET"] = 1] = "STREET";
@@ -6111,6 +5936,13 @@ const CAPITAL_COSTS_ITEMS = [
6111
5936
  }),
6112
5937
  ];
6113
5938
 
5939
+ /**
5940
+ * https://api-uat.corelogic.asia/property/au/v2/suggest.json
5941
+ * address suggestion from corelogic service
5942
+ */
5943
+ class CorelogicSuggestion {
5944
+ }
5945
+
6114
5946
  /**
6115
5947
  * class contains equity information for passed financial year
6116
5948
  */
@@ -10827,6 +10659,174 @@ __decorate([
10827
10659
  Type(() => TaxReturnItem)
10828
10660
  ], TaxReturn.prototype, "taxReturnItems", void 0);
10829
10661
 
10662
+ class CorelogicService {
10663
+ constructor(http, environment) {
10664
+ this.http = http;
10665
+ this.environment = environment;
10666
+ this.accessTokenSubject = new ReplaySubject(1);
10667
+ }
10668
+ getAccessToken(force = false) {
10669
+ if (!this._accessToken || force) {
10670
+ this.http.get(`${this.environment.apiV2}/corelogic/tokens`)
10671
+ .pipe(map((response) => response.access_token))
10672
+ .subscribe((token) => {
10673
+ this._accessToken = token;
10674
+ this.accessTokenSubject.next(this._accessToken);
10675
+ });
10676
+ }
10677
+ return this.accessTokenSubject.asObservable();
10678
+ }
10679
+ getSuggestions(query, country = 'au') {
10680
+ // @TODO handle different countries in future
10681
+ return this.http.get(`${this.environment.coreLogicUrl}/property/${country}/v2/suggest.json?q=${query}`)
10682
+ .pipe(map((response) => response.suggestions.map((item) => plainToClass(CorelogicSuggestion, item))));
10683
+ }
10684
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
10685
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicService, providedIn: 'root' }); }
10686
+ }
10687
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicService, decorators: [{
10688
+ type: Injectable,
10689
+ args: [{
10690
+ providedIn: 'root'
10691
+ }]
10692
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
10693
+ type: Inject,
10694
+ args: ['environment']
10695
+ }] }] });
10696
+
10697
+ /**
10698
+ * Corelogic interceptor add Core Logic access token for each search requests related with Core Logic API
10699
+ */
10700
+ class CorelogicInterceptor {
10701
+ constructor(corelogicService, environment) {
10702
+ this.corelogicService = corelogicService;
10703
+ this.environment = environment;
10704
+ }
10705
+ intercept(request, next) {
10706
+ // skip non-corelogic requests
10707
+ if (!request.url.includes(this.environment.coreLogicUrl)) {
10708
+ return next.handle(request);
10709
+ }
10710
+ // don't need token for this endpoint
10711
+ if (request.url.includes(`${this.environment.coreLogicUrl}/access/oauth/token`)) {
10712
+ return next.handle(request);
10713
+ }
10714
+ return this.corelogicService.getAccessToken()
10715
+ .pipe(mergeMap((token) => next.handle(this.addToken(request, token))));
10716
+ }
10717
+ addToken(request, token) {
10718
+ return request.clone({
10719
+ setHeaders: {
10720
+ Authorization: 'Bearer ' + token
10721
+ }
10722
+ });
10723
+ }
10724
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicInterceptor, deps: [{ token: CorelogicService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
10725
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicInterceptor }); }
10726
+ }
10727
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CorelogicInterceptor, decorators: [{
10728
+ type: Injectable
10729
+ }], ctorParameters: () => [{ type: CorelogicService }, { type: undefined, decorators: [{
10730
+ type: Inject,
10731
+ args: ['environment']
10732
+ }] }] });
10733
+
10734
+ /**
10735
+ * Financial Year interceptor add financialYear parameter to requests because a lot of POST and GET requests require this parameter
10736
+ * @TODO now we can get current fin year from user on backend. So we can remove this interceptor
10737
+ */
10738
+ class FinancialYearInterceptor {
10739
+ constructor(environment) {
10740
+ this.environment = environment;
10741
+ }
10742
+ intercept(request, next) {
10743
+ // skip third party requests
10744
+ // @TODO Alex: Also check and ignore requests we don't need financial year
10745
+ if (!request.url.includes(this.environment.api_uri)) {
10746
+ return next.handle(request);
10747
+ }
10748
+ // Set financial year parameter to requests
10749
+ let params = new HttpParams({
10750
+ fromString: request.params.toString()
10751
+ });
10752
+ // clone request to add new parameters
10753
+ let clonedReq = request.clone();
10754
+ // @TODO query params should be passed using second param of get request and HttpParams object
10755
+ if (!params.get('financialYear') && !request.urlWithParams.includes('?financialYear') && !request.urlWithParams.includes('&financialYear')) {
10756
+ params = params.set('financialYear', localStorage.getItem('financialYear'));
10757
+ clonedReq = request.clone({
10758
+ params: params
10759
+ });
10760
+ }
10761
+ return next.handle(clonedReq);
10762
+ }
10763
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FinancialYearInterceptor, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
10764
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FinancialYearInterceptor }); }
10765
+ }
10766
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FinancialYearInterceptor, decorators: [{
10767
+ type: Injectable
10768
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
10769
+ type: Inject,
10770
+ args: ['environment']
10771
+ }] }] });
10772
+
10773
+ class AddressService {
10774
+ constructor(http, environment) {
10775
+ this.http = http;
10776
+ this.environment = environment;
10777
+ this.countriesSubject = new ReplaySubject(1);
10778
+ }
10779
+ getCountries() {
10780
+ if (!this._countries) {
10781
+ this.http.get(`${this.environment.apiV2}/countries`)
10782
+ .pipe(map((response) => response.map((item) => plainToClass(Country, item))))
10783
+ .subscribe((countries) => {
10784
+ this._countries = countries;
10785
+ this.countriesSubject.next(countries);
10786
+ });
10787
+ }
10788
+ return this.countriesSubject.asObservable();
10789
+ }
10790
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddressService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
10791
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddressService, providedIn: 'root' }); }
10792
+ }
10793
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddressService, decorators: [{
10794
+ type: Injectable,
10795
+ args: [{
10796
+ providedIn: 'root'
10797
+ }]
10798
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
10799
+ type: Inject,
10800
+ args: ['environment']
10801
+ }] }] });
10802
+
10803
+ /**
10804
+ * @TODO TT-3846 upgrade
10805
+ */
10806
+ class PdfService {
10807
+ constructor(http, environment) {
10808
+ this.http = http;
10809
+ this.environment = environment;
10810
+ }
10811
+ fromHTMLElements(elements, landscape) {
10812
+ const formData = new FormData();
10813
+ formData.append('file', new Blob([...Array.from(elements).map(element => element.outerHTML)], { type: 'text/html' }));
10814
+ formData.append('landscape', landscape ? '1' : '0');
10815
+ return this.http.post(`${this.environment.apiV2}/pdf/html`, formData, { responseType: 'blob' });
10816
+ }
10817
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PdfService, deps: [{ token: i1.HttpClient }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
10818
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PdfService, providedIn: 'root' }); }
10819
+ }
10820
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PdfService, decorators: [{
10821
+ type: Injectable,
10822
+ args: [{
10823
+ providedIn: 'root'
10824
+ }]
10825
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
10826
+ type: Inject,
10827
+ args: ['environment']
10828
+ }] }] });
10829
+
10830
10830
  /**
10831
10831
  * @TODO Alex (TT-1777): replace old logic with the new when all services ready
10832
10832
  * @TODO Alex (TT-1777): rename old logic and keep it for custom events