@snabcentr/client-core 2.45.1 → 2.46.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.
Files changed (32) hide show
  1. package/config/index.d.ts +1 -0
  2. package/config/sc-i-api-keys.d.ts +5 -1
  3. package/config/sc-i-feedback-api.d.ts +17 -0
  4. package/contacts/dto/sc-i-feedback-message.d.ts +5 -0
  5. package/contacts/enums/index.d.ts +1 -0
  6. package/contacts/enums/sc-feedback-forms.d.ts +29 -0
  7. package/contacts/services/sc-feedback.service.d.ts +11 -6
  8. package/esm2022/config/index.mjs +2 -1
  9. package/esm2022/config/sc-i-api-keys.mjs +1 -1
  10. package/esm2022/config/sc-i-feedback-api.mjs +2 -0
  11. package/esm2022/contacts/dto/sc-i-feedback-message.mjs +1 -1
  12. package/esm2022/contacts/enums/index.mjs +2 -1
  13. package/esm2022/contacts/enums/sc-feedback-forms.mjs +2 -0
  14. package/esm2022/contacts/services/sc-feedback.service.mjs +31 -11
  15. package/esm2022/references/dto/sc-i-references-types.mjs +1 -1
  16. package/esm2022/references/enums/index.mjs +1 -2
  17. package/esm2022/references/enums/sc-reference-name.mjs +1 -5
  18. package/esm2022/references/services/sc-references.service.mjs +1 -5
  19. package/esm2022/tokens/index.mjs +2 -1
  20. package/esm2022/tokens/sc-feedback-api.mjs +6 -0
  21. package/fesm2022/snabcentr-client-core.mjs +32 -42
  22. package/fesm2022/snabcentr-client-core.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/references/dto/sc-i-references-types.d.ts +1 -1
  25. package/references/enums/index.d.ts +0 -1
  26. package/references/enums/sc-reference-name.d.ts +1 -5
  27. package/references/services/sc-references.service.d.ts +0 -5
  28. package/release_notes.tmp +6 -2
  29. package/tokens/index.d.ts +1 -0
  30. package/tokens/sc-feedback-api.d.ts +6 -0
  31. package/esm2022/references/enums/sc-feedback-form.mjs +0 -25
  32. package/references/enums/sc-feedback-form.d.ts +0 -22
@@ -297,6 +297,11 @@ const SC_UPDATE_INTERVAL = new InjectionToken('UPDATE_INTERVAL');
297
297
  */
298
298
  const SC_URLS = new InjectionToken('IUrls');
299
299
 
300
+ /**
301
+ * Токен внедрения данных API обратной связи.
302
+ */
303
+ const SC_FEEDBACK_API = tuiCreateToken();
304
+
300
305
  /**
301
306
  * Перечисление названий целей метрики используемых для отслеживания действий пользователей.
302
307
  */
@@ -1873,10 +1878,6 @@ var ScReferenceName;
1873
1878
  * Валюта.
1874
1879
  */
1875
1880
  ScReferenceName["currency"] = "currency";
1876
- /**
1877
- * Тип канала сообщений чата.
1878
- */
1879
- ScReferenceName["feedbackForm"] = "feedback-form";
1880
1881
  })(ScReferenceName || (ScReferenceName = {}));
1881
1882
 
1882
1883
  /* eslint-disable security/detect-object-injection,no-param-reassign */
@@ -2049,10 +2050,6 @@ class ScReferencesService {
2049
2050
  * Список статусов рекламаций.
2050
2051
  */
2051
2052
  this.reclamationStatuses$ = this.getReference$(ScReferenceName.reclamationStatus);
2052
- /**
2053
- * Список форм обратной связи.
2054
- */
2055
- this.feedbackForms$ = this.getReference$(ScReferenceName.feedbackForm);
2056
2053
  /**
2057
2054
  * Список организационно-правовых форм..
2058
2055
  */
@@ -3632,13 +3629,24 @@ class ScFeedbackService {
3632
3629
  * Инициализирует экземпляр класса {@link ScFeedbackService}.
3633
3630
  *
3634
3631
  * @param http HTTP-клиент.
3635
- * @param urls Список ссылок на разделы backend'a.
3636
3632
  * @param userMetrikaService Сервис для сбора метрик о действиях пользователей.
3633
+ * @param feedbackApi Данные для взаимодействия с API обратной связи.
3637
3634
  */
3638
- constructor(http, urls, userMetrikaService) {
3635
+ constructor(http, userMetrikaService, feedbackApi) {
3639
3636
  this.http = http;
3640
- this.urls = urls;
3641
3637
  this.userMetrikaService = userMetrikaService;
3638
+ this.feedbackApi = feedbackApi;
3639
+ /**
3640
+ * Список форм обратной связи.
3641
+ */
3642
+ this.feedbackForms$ = this.http
3643
+ .get(`${this.feedbackApi.apiUrl}/feedback/forms`, {
3644
+ context: new HttpContext().set(SC_AUTH_ADD_HEADER_REQUIRED, false),
3645
+ headers: {
3646
+ [this.feedbackApi.keyName]: this.feedbackApi.authToken,
3647
+ },
3648
+ })
3649
+ .pipe(shareReplay(1));
3642
3650
  }
3643
3651
  /**
3644
3652
  * Отправляет сообщение обратной связи.
@@ -3647,13 +3655,20 @@ class ScFeedbackService {
3647
3655
  * @param feedbackMessage Объект сообщения обратной связи.
3648
3656
  */
3649
3657
  sendFeedback(formSlug, feedbackMessage) {
3650
- return this.http.post(`${this.urls.apiUrl}/feedback/${formSlug}`, feedbackMessage).pipe(tap(() => {
3658
+ return this.http
3659
+ .post(`${this.feedbackApi.apiUrl}/feedback/${formSlug}`, feedbackMessage, {
3660
+ context: new HttpContext().set(SC_AUTH_ADD_HEADER_REQUIRED, false),
3661
+ headers: {
3662
+ [this.feedbackApi.keyName]: this.feedbackApi.authToken,
3663
+ },
3664
+ })
3665
+ .pipe(tap(() => {
3651
3666
  this.userMetrikaService.emitUserMetrikaEvent({
3652
3667
  target: ScUserMetrikaGoalsEnum.feedbackSent,
3653
3668
  });
3654
3669
  }));
3655
3670
  }
3656
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScFeedbackService, deps: [{ token: i1$1.HttpClient }, { token: SC_URLS }, { token: ScUserMetrikaService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3671
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScFeedbackService, deps: [{ token: i1$1.HttpClient }, { token: ScUserMetrikaService }, { token: SC_FEEDBACK_API }], target: i0.ɵɵFactoryTarget.Injectable }); }
3657
3672
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScFeedbackService, providedIn: 'root' }); }
3658
3673
  }
3659
3674
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: ScFeedbackService, decorators: [{
@@ -3661,10 +3676,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
3661
3676
  args: [{
3662
3677
  providedIn: 'root',
3663
3678
  }]
3664
- }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: undefined, decorators: [{
3679
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: ScUserMetrikaService }, { type: undefined, decorators: [{
3665
3680
  type: Inject,
3666
- args: [SC_URLS]
3667
- }] }, { type: ScUserMetrikaService }] });
3681
+ args: [SC_FEEDBACK_API]
3682
+ }] }] });
3668
3683
 
3669
3684
  /**
3670
3685
  * Сервис для работы с реквизитами и с обойной связью.
@@ -4991,31 +5006,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
4991
5006
  type: Injectable
4992
5007
  }] });
4993
5008
 
4994
- /**
4995
- * Перечисление форм обратной связи.
4996
- * Ключами являются символьные обозначения (slug) формы, из запроса {@link ScReferencesService.feedbackForms$}
4997
- */
4998
- // eslint-disable-next-line no-shadow
4999
- var ScFeedbackForm;
5000
- (function (ScFeedbackForm) {
5001
- /**
5002
- * Стандартная форма обратной связи.
5003
- */
5004
- ScFeedbackForm[ScFeedbackForm["common"] = 1] = "common";
5005
- /**
5006
- * Форма заявки на запрос бесплатных образцов.
5007
- */
5008
- ScFeedbackForm[ScFeedbackForm["samples"] = 2] = "samples";
5009
- /**
5010
- * Форма обратной связи со страницы контактов.
5011
- */
5012
- ScFeedbackForm[ScFeedbackForm["contacts"] = 3] = "contacts";
5013
- /**
5014
- * Форма обратной связи со страницы вакансий.
5015
- */
5016
- ScFeedbackForm[ScFeedbackForm["vacancies"] = 4] = "vacancies";
5017
- })(ScFeedbackForm || (ScFeedbackForm = {}));
5018
-
5019
5009
  /**
5020
5010
  * Перечисление организационно-правовых форм.
5021
5011
  */
@@ -7156,5 +7146,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
7156
7146
  * Generated bundle index. Do not edit.
7157
7147
  */
7158
7148
 
7159
- export { EMPTY_CART, IS_BROWSER, IS_RUNNING_ON_TERMINAL, IS_SERVER, RESPONSE, SC_ACCESS_AUTH_TOKEN_STORAGE_KEY, SC_API_KEYS, SC_AUTH_ADD_HEADER_REQUIRED, SC_AUTH_AS_CLIENT_DEFAULT_OPTIONS, SC_AUTH_AS_CLIENT_OPTIONS, SC_CACHE_LIFETIME, SC_CACHE_SETTINGS, SC_COMPANY_NAME, SC_CONFIGURATOR_COMPONENTS, SC_CONFIGURATOR_SETTINGS, SC_COUNT_FIRST_DISCOUNTED_PRODUCTS, SC_COUNT_LAST_NEWS, SC_DEFAULT_PAGE_META, SC_GUEST_ENDPOINTS_TOKEN, SC_GUEST_PARAMETER_NAME_TOKEN, SC_GUEST_TOKEN_STORAGE_KEY, SC_ID_OR_SLUG_IN_ROUTE, SC_IS_HEADER_REQUIRED, SC_IS_HIDDEN_ERROR_ALERT, SC_IS_HIDDEN_ERROR_ALERT_HTTP_CONTEXT, SC_IS_LOGOUT_REQUEST, SC_IS_REFRESH_REQUIRED, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_MAX_LENGTH_SEARCH_TERM, SC_MIN_LENGTH_SEARCH_TERM, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PATH_IMAGE_NOT_FOUND, SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS, SC_PRODUCT_PAGINATION_OPTIONS, SC_REFRESH_AUTH_TOKEN_STORAGE_KEY, SC_RELEASE, SC_UPDATE_INTERVAL, SC_URLS, SC_VACANCIES_DATA_SOURCE, SC_VIRTUAL_CATEGORY_INFO, SC_VIRTUAL_CATEGORY_PROVIDERS, SEARCH_TERM, SEARCH_TERM_PROVIDERS, ScAuthAsClientGuard, ScAuthInterceptor, ScAuthService, ScBannerService, ScCacheInterceptor, ScCacheSettings, ScCachedData, ScCachedItem, ScCart, ScCartItem, ScCartService, ScCatalogFormat, ScCatalogService, ScCategory, ScClientType, ScConfiguratorService, ScContactsService, ScContragentService, ScConvertInterceptor, ScConvertersService, ScDeliveryAddressService, ScDeliveryCost, ScDeliveryType, ScDocumentInfoNode, ScDocumentInfoTypesEnum, ScErrorsInterceptor, ScFavoriteService, ScFeedbackForm, ScFeedbackService, ScFilesService, ScFrequentlyAskedQuestionsService, ScGuestInterceptor, ScISalesDirectionCart, ScISuggestionType, ScIconTypesEnum, ScIdOrSlugGuard, ScIdOrSlugPipe, ScImageHelper, ScJsonLdComponent, ScJsonLdModule, ScLocationsService, ScMimeTypes, ScNews, ScNewsService, ScNotificationActionTypes, ScNotificationLevelNames, ScNotificationsService, ScOpfList, ScOptionsInterceptor, ScOrder, ScOrderShort, ScOrderStateStatus, ScOrdersService, ScPaginationService, ScPaymentStatus, ScPaymentType, ScPhoneService, ScProduct, ScProductTileType, ScQuestionnaireService, ScQuestionnaireStatusEnum, ScReclamationService, ScReclamationStatus, ScRecommendationService, ScReferenceName, ScReferencesService, ScRequisitesService, ScSearchService, ScSeoResource, ScSeoService, ScSocialType, ScSuggestionService, ScSum, ScTokenService, ScUIService, ScUTMService, ScUnitsHelper, ScUploadedFile, ScUser, ScUserMetadata, ScUserMetrikaGoalsEnum, ScUserMetrikaService, ScUserService, ScUserType, ScVCardService, ScVacanciesList, ScVacanciesService, ScVacancy, ScVerificationService, ScVirtualCategory, ScWarehouseService, TERMINAL_PROVIDERS, USER_AGENT_TERMINAL, filterChangedByKey, runningOnTerminalFactory, searchTermFactory };
7149
+ export { EMPTY_CART, IS_BROWSER, IS_RUNNING_ON_TERMINAL, IS_SERVER, RESPONSE, SC_ACCESS_AUTH_TOKEN_STORAGE_KEY, SC_API_KEYS, SC_AUTH_ADD_HEADER_REQUIRED, SC_AUTH_AS_CLIENT_DEFAULT_OPTIONS, SC_AUTH_AS_CLIENT_OPTIONS, SC_CACHE_LIFETIME, SC_CACHE_SETTINGS, SC_COMPANY_NAME, SC_CONFIGURATOR_COMPONENTS, SC_CONFIGURATOR_SETTINGS, SC_COUNT_FIRST_DISCOUNTED_PRODUCTS, SC_COUNT_LAST_NEWS, SC_DEFAULT_PAGE_META, SC_FEEDBACK_API, SC_GUEST_ENDPOINTS_TOKEN, SC_GUEST_PARAMETER_NAME_TOKEN, SC_GUEST_TOKEN_STORAGE_KEY, SC_ID_OR_SLUG_IN_ROUTE, SC_IS_HEADER_REQUIRED, SC_IS_HIDDEN_ERROR_ALERT, SC_IS_HIDDEN_ERROR_ALERT_HTTP_CONTEXT, SC_IS_LOGOUT_REQUEST, SC_IS_REFRESH_REQUIRED, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_MAX_LENGTH_SEARCH_TERM, SC_MIN_LENGTH_SEARCH_TERM, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PATH_IMAGE_NOT_FOUND, SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS, SC_PRODUCT_PAGINATION_OPTIONS, SC_REFRESH_AUTH_TOKEN_STORAGE_KEY, SC_RELEASE, SC_UPDATE_INTERVAL, SC_URLS, SC_VACANCIES_DATA_SOURCE, SC_VIRTUAL_CATEGORY_INFO, SC_VIRTUAL_CATEGORY_PROVIDERS, SEARCH_TERM, SEARCH_TERM_PROVIDERS, ScAuthAsClientGuard, ScAuthInterceptor, ScAuthService, ScBannerService, ScCacheInterceptor, ScCacheSettings, ScCachedData, ScCachedItem, ScCart, ScCartItem, ScCartService, ScCatalogFormat, ScCatalogService, ScCategory, ScClientType, ScConfiguratorService, ScContactsService, ScContragentService, ScConvertInterceptor, ScConvertersService, ScDeliveryAddressService, ScDeliveryCost, ScDeliveryType, ScDocumentInfoNode, ScDocumentInfoTypesEnum, ScErrorsInterceptor, ScFavoriteService, ScFeedbackService, ScFilesService, ScFrequentlyAskedQuestionsService, ScGuestInterceptor, ScISalesDirectionCart, ScISuggestionType, ScIconTypesEnum, ScIdOrSlugGuard, ScIdOrSlugPipe, ScImageHelper, ScJsonLdComponent, ScJsonLdModule, ScLocationsService, ScMimeTypes, ScNews, ScNewsService, ScNotificationActionTypes, ScNotificationLevelNames, ScNotificationsService, ScOpfList, ScOptionsInterceptor, ScOrder, ScOrderShort, ScOrderStateStatus, ScOrdersService, ScPaginationService, ScPaymentStatus, ScPaymentType, ScPhoneService, ScProduct, ScProductTileType, ScQuestionnaireService, ScQuestionnaireStatusEnum, ScReclamationService, ScReclamationStatus, ScRecommendationService, ScReferenceName, ScReferencesService, ScRequisitesService, ScSearchService, ScSeoResource, ScSeoService, ScSocialType, ScSuggestionService, ScSum, ScTokenService, ScUIService, ScUTMService, ScUnitsHelper, ScUploadedFile, ScUser, ScUserMetadata, ScUserMetrikaGoalsEnum, ScUserMetrikaService, ScUserService, ScUserType, ScVCardService, ScVacanciesList, ScVacanciesService, ScVacancy, ScVerificationService, ScVirtualCategory, ScWarehouseService, TERMINAL_PROVIDERS, USER_AGENT_TERMINAL, filterChangedByKey, runningOnTerminalFactory, searchTermFactory };
7160
7150
  //# sourceMappingURL=snabcentr-client-core.mjs.map