@snabcentr/client-core 2.42.4 → 2.43.0

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.
@@ -7,7 +7,7 @@ import { startWith, Subject, ReplaySubject, partition, combineLatest, map, debou
7
7
  import { isPlatformBrowser, isPlatformServer, DOCUMENT, formatDate } from '@angular/common';
8
8
  import { tuiCreateTokenFromFactory, tuiCreateToken, TuiDay, tuiIsPresent, tuiPure } from '@taiga-ui/cdk';
9
9
  import * as i1$1 from '@angular/common/http';
10
- import { HttpContextToken, HttpContext, HttpHeaders, HttpParams, HttpClient, HttpResponse, HttpErrorResponse } from '@angular/common/http';
10
+ import { HttpContextToken, HttpContext, HttpHeaders, HttpClient, HttpParams, HttpResponse, HttpErrorResponse } from '@angular/common/http';
11
11
  import { tuiCleanObject } from '@taiga-ui/addon-doc/utils';
12
12
  import { __decorate } from 'tslib';
13
13
  import * as i2 from '@angular/router';
@@ -1625,21 +1625,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
1625
1625
  * Сервис информации о пользователе.
1626
1626
  */
1627
1627
  class ScUserService {
1628
- /**
1629
- * Инициализирует экземпляр класса {@link ScUserService}.
1630
- *
1631
- * @param authService Сервис аутентификации.
1632
- * @param urls Список ссылок на разделы backend'a.
1633
- * @param http HTTP-клиент.
1634
- * @param userMetrikaService Сервис для сбора метрик о действиях пользователей.
1635
- * @param contactsService Сервис для работы с контактными лицами.
1636
- */
1637
- constructor(authService, urls, http, userMetrikaService, contactsService) {
1638
- this.authService = authService;
1639
- this.urls = urls;
1640
- this.http = http;
1641
- this.userMetrikaService = userMetrikaService;
1642
- this.contactsService = contactsService;
1628
+ constructor() {
1643
1629
  /**
1644
1630
  * {@link ReplaySubject} данных о текущем пользователе.
1645
1631
  */
@@ -1652,6 +1638,26 @@ class ScUserService {
1652
1638
  * Признак, что скрипт выполняется в браузере.
1653
1639
  */
1654
1640
  this.isBrowser = inject(IS_BROWSER);
1641
+ /**
1642
+ * Сервис аутентификации.
1643
+ */
1644
+ this.authService = inject(ScAuthService);
1645
+ /**
1646
+ * Список ссылок на разделы backend'a.
1647
+ */
1648
+ this.urls = inject(SC_URLS);
1649
+ /**
1650
+ * HTTP-клиент.
1651
+ */
1652
+ this.http = inject(HttpClient);
1653
+ /**
1654
+ * Сервис для сбора метрик о действиях пользователей.
1655
+ */
1656
+ this.userMetrikaService = inject(ScUserMetrikaService);
1657
+ /**
1658
+ * Сервис для работы с контактными лицами.
1659
+ */
1660
+ this.contactsService = inject(ScContactsService);
1655
1661
  }
1656
1662
  /**
1657
1663
  * Выполняет инициализацию сервиса.
@@ -1779,7 +1785,7 @@ class ScUserService {
1779
1785
  deleteUserContact$(contactId) {
1780
1786
  return this.contactsService.deleteContact$(contactId);
1781
1787
  }
1782
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScUserService, deps: [{ token: ScAuthService }, { token: SC_URLS }, { token: i1$1.HttpClient }, { token: ScUserMetrikaService }, { token: ScContactsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1788
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScUserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1783
1789
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScUserService, providedIn: 'root' }); }
1784
1790
  }
1785
1791
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScUserService, decorators: [{
@@ -1787,10 +1793,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
1787
1793
  args: [{
1788
1794
  providedIn: 'root',
1789
1795
  }]
1790
- }], ctorParameters: () => [{ type: ScAuthService }, { type: undefined, decorators: [{
1791
- type: Inject,
1792
- args: [SC_URLS]
1793
- }] }, { type: i1$1.HttpClient }, { type: ScUserMetrikaService }, { type: ScContactsService }] });
1796
+ }] });
1794
1797
 
1795
1798
  /**
1796
1799
  * Перечисление названий справочников.
@@ -5133,25 +5136,11 @@ var ScReclamationStatus;
5133
5136
  * Сервис для получения списков стран, регионов, городов.
5134
5137
  */
5135
5138
  class ScLocationsService {
5136
- /**
5137
- * Инициализирует экземпляр класса {@link ScLocationsService}.
5138
- *
5139
- * @param authService Сервис аутентификации.
5140
- * @param referencesService Сервис справочников.
5141
- */
5142
- constructor(authService, referencesService) {
5143
- this.authService = authService;
5144
- this.referencesService = referencesService;
5139
+ constructor() {
5145
5140
  /**
5146
- * Данные о городе текущего пользователя.
5141
+ * Сервис справочников.
5147
5142
  */
5148
- this.currentUserCity = undefined;
5149
- authService
5150
- .getAuthChange()
5151
- .pipe(filter((state) => !state))
5152
- .subscribe(() => {
5153
- this.currentUserCity = undefined;
5154
- });
5143
+ this.referencesService = inject(ScReferencesService);
5155
5144
  }
5156
5145
  /**
5157
5146
  * Создает запрос получения списка стран.
@@ -5165,6 +5154,14 @@ class ScLocationsService {
5165
5154
  * @param countryId Идентификатор записи страны {@link number}.
5166
5155
  */
5167
5156
  getRegions$(countryId) {
5157
+ return this.referencesService.getReference$(ScReferenceName.region, { countryId: countryId });
5158
+ }
5159
+ /**
5160
+ * Создает запрос получения списка регионов указанной страны с информацией о стране.
5161
+ *
5162
+ * @param countryId Идентификатор записи страны {@link number}.
5163
+ */
5164
+ getRegionsWithCountry$(countryId) {
5168
5165
  return this.referencesService.getReference$(ScReferenceName.regionWithCountry, { countryId: countryId });
5169
5166
  }
5170
5167
  /**
@@ -5174,10 +5171,28 @@ class ScLocationsService {
5174
5171
  * @param regionId Идентификатор записи региона {@link regionId}.
5175
5172
  */
5176
5173
  getCities$(countryId, regionId) {
5174
+ return this.referencesService.getReference$(ScReferenceName.city, { countryId: countryId, regionId: regionId });
5175
+ }
5176
+ /**
5177
+ * Создает запрос получения списка городов указанного региона и страны с информацией о регионе.
5178
+ *
5179
+ * @param countryId Идентификатор записи страны {@link number}.
5180
+ * @param regionId Идентификатор записи региона {@link regionId}.
5181
+ */
5182
+ getCitiesWithRegion$(countryId, regionId) {
5177
5183
  return this.referencesService.getReference$(ScReferenceName.cityWithRegion, { countryId: countryId, regionId: regionId });
5178
5184
  }
5179
5185
  /**
5180
- * Создает запрос получения списка городов указанного региона.
5186
+ * Создает запрос получения списка городов указанного региона и страны с информацией о регионе и стране.
5187
+ *
5188
+ * @param countryId Идентификатор записи страны {@link number}.
5189
+ * @param regionId Идентификатор записи региона {@link regionId}.
5190
+ */
5191
+ getCityesWithRegionAndCountry$(countryId, regionId) {
5192
+ return this.referencesService.getReference$(ScReferenceName.cityWithRegionAndCountry, { countryId: countryId, regionId: regionId });
5193
+ }
5194
+ /**
5195
+ * Создает запрос получения списка городов указанного региона и страны по поисковому запросу.
5181
5196
  *
5182
5197
  * @param term Поисковый запрос.
5183
5198
  * @param countryId Идентификатор записи страны.
@@ -5187,26 +5202,14 @@ class ScLocationsService {
5187
5202
  return this.referencesService.getReferenceByTerm$(ScReferenceName.cityWithRegion, term, { countryId: countryId, regionId: regionId });
5188
5203
  }
5189
5204
  /**
5190
- * Создает запрос получения информации о городе по идентификатору.
5205
+ * Создает запрос получения информации о городе с информацией о регионе и стране.
5191
5206
  *
5192
5207
  * @param cityId Идентификатор записи города.
5193
5208
  */
5194
5209
  getCityById$(cityId) {
5195
5210
  return this.referencesService.getReferenceById$(ScReferenceName.cityWithRegionAndCountry, cityId);
5196
5211
  }
5197
- /**
5198
- * Создает запрос получения информации о городе текшего пользователя по идентификатору города.
5199
- *
5200
- * @param cityId Идентификатор записи города.
5201
- */
5202
- getUserCity$(cityId) {
5203
- if (this.currentUserCity && this.currentUserCity.id === cityId) {
5204
- return of(this.currentUserCity);
5205
- }
5206
- // eslint-disable-next-line no-return-assign
5207
- return this.getCityById$(cityId).pipe(tap((city) => (this.currentUserCity = city)));
5208
- }
5209
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScLocationsService, deps: [{ token: ScAuthService }, { token: ScReferencesService }], target: i0.ɵɵFactoryTarget.Injectable }); }
5212
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScLocationsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5210
5213
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScLocationsService, providedIn: 'root' }); }
5211
5214
  }
5212
5215
  __decorate([
@@ -5215,9 +5218,18 @@ __decorate([
5215
5218
  __decorate([
5216
5219
  tuiPure
5217
5220
  ], ScLocationsService.prototype, "getRegions$", null);
5221
+ __decorate([
5222
+ tuiPure
5223
+ ], ScLocationsService.prototype, "getRegionsWithCountry$", null);
5218
5224
  __decorate([
5219
5225
  tuiPure
5220
5226
  ], ScLocationsService.prototype, "getCities$", null);
5227
+ __decorate([
5228
+ tuiPure
5229
+ ], ScLocationsService.prototype, "getCitiesWithRegion$", null);
5230
+ __decorate([
5231
+ tuiPure
5232
+ ], ScLocationsService.prototype, "getCityesWithRegionAndCountry$", null);
5221
5233
  __decorate([
5222
5234
  tuiPure
5223
5235
  ], ScLocationsService.prototype, "getCitiesByTerm$", null);
@@ -5229,7 +5241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
5229
5241
  args: [{
5230
5242
  providedIn: 'root',
5231
5243
  }]
5232
- }], ctorParameters: () => [{ type: ScAuthService }, { type: ScReferencesService }], propDecorators: { getCountries$: [], getRegions$: [], getCities$: [], getCitiesByTerm$: [], getCityById$: [] } });
5244
+ }], propDecorators: { getCountries$: [], getRegions$: [], getRegionsWithCountry$: [], getCities$: [], getCitiesWithRegion$: [], getCityesWithRegionAndCountry$: [], getCitiesByTerm$: [], getCityById$: [] } });
5233
5245
 
5234
5246
  /**
5235
5247
  * Модель данных новости.