@snabcentr/client-core 3.27.0 → 3.28.1

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.
@@ -2377,6 +2377,12 @@ class ScOrderItem {
2377
2377
  get isUnavailableReasonNeutral() {
2378
2378
  return false;
2379
2379
  }
2380
+ /**
2381
+ * Признак, что для позиции можно указать товар каталога вместо ненайденного.
2382
+ */
2383
+ get isProductSpecifiable() {
2384
+ return false;
2385
+ }
2380
2386
  /**
2381
2387
  * Шаг изменения количества позиции.
2382
2388
  */
@@ -2392,6 +2398,12 @@ class ScOrderItem {
2392
2398
  }
2393
2399
  return this.product.isHidden ? 'Товар больше не предоставляется' : '';
2394
2400
  }
2401
+ /**
2402
+ * Возвращает предупреждение к позиции, которое не мешает ей попасть в заказ, или пустую строку.
2403
+ */
2404
+ getNotice() {
2405
+ return '';
2406
+ }
2395
2407
  /**
2396
2408
  * @inheritDoc
2397
2409
  */
@@ -7394,6 +7406,7 @@ class ScProfstroyOrderItem extends ScOrderItem {
7394
7406
  this.groupName = data.groupName?.trim() ? data.groupName.trim() : undefined;
7395
7407
  this.isIgnored = data.isIgnored ?? false;
7396
7408
  this.lineError = data.lineError?.trim() ? data.lineError.trim() : undefined;
7409
+ this.lineNotice = data.lineNotice?.trim() ? data.lineNotice.trim() : undefined;
7397
7410
  if (isProductStub) {
7398
7411
  const supplierSku = data.supplierSku ?? data.product?.supplierSku ?? undefined;
7399
7412
  this.product = ScProduct.createNotFound(data.product?.name, supplierSku);
@@ -7417,6 +7430,12 @@ class ScProfstroyOrderItem extends ScOrderItem {
7417
7430
  get isInactive() {
7418
7431
  return this.isIgnored || super.isInactive;
7419
7432
  }
7433
+ /**
7434
+ * Признак, что для позиции можно указать товар каталога: товар не найден, а группа участвует в заказе.
7435
+ */
7436
+ get isProductSpecifiable() {
7437
+ return this.product.isNull && !this.isIgnored;
7438
+ }
7420
7439
  /**
7421
7440
  * @inheritDoc
7422
7441
  */
@@ -7435,6 +7454,12 @@ class ScProfstroyOrderItem extends ScOrderItem {
7435
7454
  }
7436
7455
  return super.getUnavailableReason();
7437
7456
  }
7457
+ /**
7458
+ * @inheritDoc
7459
+ */
7460
+ getNotice() {
7461
+ return this.lineNotice ?? '';
7462
+ }
7438
7463
  }
7439
7464
 
7440
7465
  /**
@@ -7776,6 +7801,10 @@ class ScOrderDraftsService {
7776
7801
  * Коды отказа, после которых черновик перезапрашивается.
7777
7802
  */
7778
7803
  static { this.rejectionStatuses = [HttpStatusCode.Forbidden, HttpStatusCode.Conflict]; }
7804
+ /**
7805
+ * Коды отказа и отсутствия позиции, после которых черновик перезапрашивается: позицию могли удалить или собрать заново.
7806
+ */
7807
+ static { this.rejectionOrMissingStatuses = [...ScOrderDraftsService.rejectionStatuses, HttpStatusCode.NotFound]; }
7779
7808
  /**
7780
7809
  * Возвращает ключ очереди запросов черновика.
7781
7810
  *
@@ -7936,6 +7965,22 @@ class ScOrderDraftsService {
7936
7965
  });
7937
7966
  }), this.updatesDraft(offerId));
7938
7967
  }
7968
+ /**
7969
+ * Указывает товар каталога для позиции черновика Профстрой, по которой товар не найден. После 404 черновик тоже перезапрашивается:
7970
+ * позицию могли удалить или собрать заново.
7971
+ *
7972
+ * @param offerId Идентификатор черновика.
7973
+ * @param itemId Идентификатор позиции.
7974
+ * @param productId Идентификатор товара каталога.
7975
+ */
7976
+ specifyProfstroyProduct$(offerId, itemId, productId) {
7977
+ const body = { productId };
7978
+ return this.http
7979
+ .patch(`${this.urls.apiUrl}/orders/offers/${offerId}/profstroy/products/${itemId}/product`, body, {
7980
+ context: ScOrderDraftsService.getErrorContext('Не удалось сохранить товар позиции.'),
7981
+ })
7982
+ .pipe(this.updatesDraft(offerId, ScOrderDraftsService.rejectionOrMissingStatuses));
7983
+ }
7939
7984
  /**
7940
7985
  * Создаёт новое коммерческое предложение/черновик заказа.
7941
7986
  *
@@ -8118,7 +8163,7 @@ class ScOrderDraftsService {
8118
8163
  body,
8119
8164
  context: ScOrderDraftsService.getErrorContext('Не удалось удалить позиции.'),
8120
8165
  })
8121
- .pipe(this.updatesDraft(offerId, [...ScOrderDraftsService.rejectionStatuses, HttpStatusCode.NotFound]));
8166
+ .pipe(this.updatesDraft(offerId, ScOrderDraftsService.rejectionOrMissingStatuses));
8122
8167
  }
8123
8168
  /**
8124
8169
  * Возвращает оператор запроса, который отвечает черновиком целиком: ответ кладётся в кэш, после отказа черновик перезапрашивается,