@snabcentr/client-ui 5.3.0 → 5.3.2

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, Injectable, NgZone, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, signal, ChangeDetectorRef, Directive, Pipe, ElementRef, Renderer2, HostListener, input, computed, model, output, DestroyRef, effect, ViewChild, ContentChild, viewChild, HostBinding, ContentChildren, forwardRef, contentChild, TemplateRef } from '@angular/core';
3
- import { ScContactsService, ScUserService, ScLocationsService, ScSuggestionService, ScISuggestionType, SC_MIN_LENGTH_SEARCH_TERM, ScAuthService, SEARCH_TERM, ScUnitsHelper, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, ScImage, ScPhoneService, ScUserMetrikaService, ScUserMetrikaGoalsEnum, ScVCardService, IS_RUNNING_ON_TERMINAL, ScVerificationService, ScConvertersService, ScReferencesService, ScOpfList, ScBannerService, ScMediaImageTransformerPipe, ScCartService, ScUploadedFile, loadingPlaceholder, SC_ORDER_LOADER, ScMimeTypes, ScCatalogService, IS_SERVER, ScWarehouseService, SEARCH_TERM_PROVIDERS, ScPaginationService, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_OPTIONS, ScCatalogFilterService, ScIdOrSlugPipe, SC_CATEGORY_INFO, ScConfiguratorService, ScContragentService, ScDeliveryAddressService, SC_URLS, RESPONSE, ScIconTypesEnum, ScDocumentInfoTypesEnum, ScFilesService, ScOrdersService, ScUIService, SC_USER_INFO as SC_USER_INFO$1, ScPaymentType, ScDeliveryType, TERMINAL_PROVIDERS, ScOrderDraftsService, ScRouteKeys, ScSeoService, scOrderIsLoaded, ScFrequentlyAskedQuestionsService, SC_COMPANY_INFO, ScFeedbackService } from '@snabcentr/client-core';
2
+ import { InjectionToken, inject, Injectable, NgZone, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, signal, ChangeDetectorRef, Directive, Pipe, ElementRef, Renderer2, HostListener, input, computed, model, output, DestroyRef, effect, ViewChild, ContentChild, viewChild, HostBinding, ContentChildren, forwardRef, contentChild, TemplateRef, RESPONSE_INIT } from '@angular/core';
3
+ import { ScContactsService, ScUserService, ScLocationsService, ScSuggestionService, ScISuggestionType, SC_MIN_LENGTH_SEARCH_TERM, ScAuthService, SEARCH_TERM, ScUnitsHelper, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, ScImage, ScPhoneService, ScUserMetrikaService, ScUserMetrikaGoalsEnum, ScVCardService, IS_RUNNING_ON_TERMINAL, ScVerificationService, ScConvertersService, ScReferencesService, ScOpfList, ScBannerService, ScMediaImageTransformerPipe, ScCartService, ScUploadedFile, loadingPlaceholder, SC_ORDER_LOADER, ScMimeTypes, ScCatalogService, IS_SERVER, ScWarehouseService, SEARCH_TERM_PROVIDERS, ScPaginationService, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_OPTIONS, ScCatalogFilterService, ScIdOrSlugPipe, SC_CATEGORY_INFO, ScConfiguratorService, ScContragentService, ScDeliveryAddressService, SC_URLS, ScIconTypesEnum, ScDocumentInfoTypesEnum, ScFilesService, ScOrdersService, ScUIService, SC_USER_INFO as SC_USER_INFO$1, ScPaymentType, ScDeliveryType, TERMINAL_PROVIDERS, ScOrderDraftsService, ScRouteKeys, ScSeoService, scOrderIsLoaded, ScFrequentlyAskedQuestionsService, SC_COMPANY_INFO, ScFeedbackService } from '@snabcentr/client-core';
4
4
  import { EMPTY, BehaviorSubject, switchMap, of, shareReplay, filter, map, debounceTime, startWith, catchError, throwError, share, Subject, tap, finalize, timer, scan, takeWhile, endWith, distinctUntilChanged, combineLatest, Observable, pairwise, Subscription, merge, skip, from, concatMap, noop, first, retry } from 'rxjs';
5
5
  import { WA_WINDOW, WA_NAVIGATOR } from '@ng-web-apis/common';
6
6
  import { takeUntilDestroyed, toSignal, outputFromObservable, toObservable } from '@angular/core/rxjs-interop';
@@ -17,7 +17,7 @@ import { AsyncPipe, DOCUMENT, NgTemplateOutlet, NgClass, CommonModule, DecimalPi
17
17
  import { isValidPhoneNumber } from 'libphonenumber-js/max';
18
18
  import { MaskitoDirective } from '@maskito/angular';
19
19
  import { getCountries } from 'libphonenumber-js';
20
- import { isNil, isUndefined, isObject, isArray, isString } from 'lodash-es';
20
+ import { isNil, isUndefined, isObject, isString, isArray } from 'lodash-es';
21
21
  import { POLYMORPHEUS_CONTEXT, PolymorpheusComponent, PolymorpheusTemplate, PolymorpheusOutlet, injectContext } from '@taiga-ui/polymorpheus';
22
22
  import { QRCodeComponent } from 'angularx-qrcode';
23
23
  import * as i3 from '@taiga-ui/core/portals/dropdown';
@@ -7096,9 +7096,9 @@ class ScErrorBlockStatusComponent {
7096
7096
  */
7097
7097
  this.isServer = inject(IS_SERVER);
7098
7098
  /**
7099
- * Данные об ответе на запрос.
7099
+ * Мутируемый объект инициализации SSR-ответа (нативный `RESPONSE_INIT`); доступен при `RenderMode.Server`.
7100
7100
  */
7101
- this.response = inject(RESPONSE, { optional: true });
7101
+ this.responseInit = inject(RESPONSE_INIT, { optional: true });
7102
7102
  // Если компонент отображён маршрутизацией из-за перехода по неизвестному маршруту, то устанавливаем код 404.
7103
7103
  if (inject(ActivatedRoute).snapshot.data['routes_key'] === 'error') {
7104
7104
  this.errorHandlerComponent.setErrorCode(404);
@@ -7106,8 +7106,8 @@ class ScErrorBlockStatusComponent {
7106
7106
  effect(() => {
7107
7107
  if (this.code() !== null) {
7108
7108
  this.pageErrorChange.emit(this.error());
7109
- if (this.isServer) {
7110
- this.response?.status(this.code() ?? 0);
7109
+ if (this.isServer && this.responseInit) {
7110
+ this.responseInit.status = this.code() ?? 0;
7111
7111
  }
7112
7112
  }
7113
7113
  });
@@ -8325,9 +8325,12 @@ class ScOrderFormComponent {
8325
8325
  /**
8326
8326
  * Возвращает признак, что указанная дата недоступна для выбора.
8327
8327
  *
8328
- * @param date Дата.
8328
+ * Календарь передаёт сюда {@link TuiDay}, а валидатор недоступных элементов поля ({@link TuiItemsHandlersValidator})
8329
+ * уже преобразованное значение контрола (строку формата `"YYYY-MM-DD 00:00:00"`), поэтому обрабатываем оба случая.
8330
+ *
8331
+ * @param date Дата в виде {@link TuiDay} или строки значения контрола.
8329
8332
  */
8330
- this.deliveryDateFilter = (date) => !this.deliveryDates().includes(`${date.toString('yyyy/mm/dd', '-')} 00:00:00`);
8333
+ this.deliveryDateFilter = (date) => !this.deliveryDates().includes(isString(date) ? date : `${date.toString('yyyy/mm/dd', '-')} 00:00:00`);
8331
8334
  // Автоматически выбираем единственного контрагента-физлицо.
8332
8335
  this.contragents$
8333
8336
  .pipe(filter((contragents) => !!contragents && contragents.length === 1), first(), filter(([contragent]) => contragent.opf.id === ScOpfList.individual.valueOf()), takeUntilDestroyed(this.destroyRef))