@snabcentr/common-lib 2.13.0 → 2.13.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.
@@ -4,6 +4,6 @@
4
4
  "name": "public-api",
5
5
  "src": "src/public-api.ts",
6
6
  "isEntry": true,
7
- "integrity": "sha384-tS7eh9lwqXKFrRXXT0E1I6HrhaJ+TRGP1fF1GhEC9APTtTrwdZSYrIWq8Rir66fL"
7
+ "integrity": "sha384-LWhApKU3AFi6u9eOI+F1EKOdPcxA5iE6s920W1f5pzw9vd5fOJMSDihU7CFwL8m7"
8
8
  }
9
9
  }
@@ -1,4 +1,4 @@
1
- ## 2.13.0 (2026-07-21)
1
+ ## 2.13.1 (2026-07-21)
2
2
 
3
3
  No changes.
4
4
 
@@ -2,13 +2,13 @@ var Nr = Object.defineProperty;
2
2
  var Ur = (n, r, e) => r in n ? Nr(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
3
3
  var s = (n, r, e) => Ur(n, typeof r != "symbol" ? r + "" : r, e);
4
4
  import { jwtDecode as ur } from "jwt-decode";
5
- import { merge as he, isNil as $, isEmpty as re, noop as v, mapValues as pr, isArray as H, every as Fr, split as Hr, isString as a, constant as Mr, toUpper as Br, cloneDeep as jr, toLower as Gr, isFunction as Me, map as ye, forEach as zr, isDate as qe, isObject as Be, omitBy as hr } from "lodash-es";
5
+ import { merge as he, isNil as $, isEmpty as re, noop as v, mapValues as pr, isArray as H, every as Fr, split as Hr, isString as a, constant as Br, toUpper as Mr, cloneDeep as jr, toLower as Gr, isFunction as Be, map as ye, forEach as zr, isDate as qe, isObject as Me, omitBy as hr } from "lodash-es";
6
6
  import { objectToCamel as je, objectToSnake as Ye } from "ts-case-convert";
7
7
  import { defineStore as W } from "pinia";
8
8
  import { ref as y, markRaw as Wr, computed as R } from "vue";
9
9
  import { isAfter as Xe, parseISO as C, startOfToday as Ne, format as L, addBusinessDays as Jr, endOfTomorrow as Vr, startOfTomorrow as Er, endOfYesterday as Kr, startOfYesterday as Qr, endOfToday as Yr, endOfDay as Xr, startOfDay as Zr, addSeconds as et } from "date-fns";
10
10
  import rt, { CanceledError as tt } from "axios";
11
- class M {
11
+ class B {
12
12
  /**
13
13
  * Инициализирует экземпляр класса {@link JwtPayload}.
14
14
  *
@@ -107,11 +107,11 @@ class M {
107
107
  * @param jwtToken JWT-ключ доступа.
108
108
  */
109
109
  static getJwtPayload(r) {
110
- const e = ur(r), t = new M(je(e));
110
+ const e = ur(r), t = new B(je(e));
111
111
  return t.resourceAccess = e.resource_access, t;
112
112
  }
113
113
  }
114
- class Et extends M {
114
+ class Et extends B {
115
115
  /**
116
116
  * Инициализирует экземпляр класса {@link DetailedJwtPayload}.
117
117
  *
@@ -151,7 +151,7 @@ class Et extends M {
151
151
  * @param jwtToken JWT-ключ доступа.
152
152
  */
153
153
  static getJwtPayload(e) {
154
- return new M(je(ur(e)));
154
+ return new B(je(ur(e)));
155
155
  }
156
156
  }
157
157
  class st {
@@ -470,7 +470,7 @@ class Pe {
470
470
  }
471
471
  function Ze(n) {
472
472
  try {
473
- const r = M.getJwtPayload(n);
473
+ const r = B.getJwtPayload(n);
474
474
  return new Date(r.exp * 1e3);
475
475
  } catch {
476
476
  return;
@@ -492,7 +492,7 @@ const Q = W("common.auth_state_private", () => {
492
492
  ), r = y(void 0), e = y(void 0), t = Wr(/* @__PURE__ */ new Map());
493
493
  function i() {
494
494
  e.value = void 0, $(n.value) || n.value.then((o) => {
495
- const c = M.getJwtPayload(o);
495
+ const c = B.getJwtPayload(o);
496
496
  e.value = c.exp * 1e3 > Date.now() ? pr(c.resourceAccess, (u) => (u == null ? void 0 : u.roles) ?? []) : void 0;
497
497
  }).catch(v);
498
498
  }
@@ -543,7 +543,7 @@ const Q = W("common.auth_state_private", () => {
543
543
  function i(o) {
544
544
  const c = Q();
545
545
  !$(c.jwtToken) && $(c.userPermissions) && c.jwtToken.then((m) => {
546
- const f = M.getJwtPayload(m);
546
+ const f = B.getJwtPayload(m);
547
547
  c.userPermissions = f.exp * 1e3 > Date.now() ? pr(f.resourceAccess, (D) => (D == null ? void 0 : D.roles) ?? []) : void 0;
548
548
  }).catch(v);
549
549
  const u = H(o) ? o.join(" && ") : o;
@@ -744,7 +744,7 @@ class de extends w {
744
744
  * Возвращает значение справочника коэффициента розничной цены.
745
745
  */
746
746
  static getRetailPriceCoefficient() {
747
- return { id: -2, slug: mr.Retail, name: "Розн. цена", guid: "", isNewRec: Mr(!0) };
747
+ return { id: -2, slug: mr.Retail, name: "Розн. цена", guid: "", isNewRec: Br(!0) };
748
748
  }
749
749
  }
750
750
  class Ge {
@@ -1089,7 +1089,7 @@ class _ extends pt {
1089
1089
  }
1090
1090
  }
1091
1091
  var ze = /* @__PURE__ */ ((n) => (n.Discount = "discount", n.PriceTemplate = "price_template", n.ClientPrice = "client_price", n.Product = "product", n))(ze || {});
1092
- class B extends _ {
1092
+ class M extends _ {
1093
1093
  /**
1094
1094
  * Инициализирует экземпляр класса {@link ClientProduct}.
1095
1095
  *
@@ -1152,7 +1152,7 @@ class ve extends Ue {
1152
1152
  * Список коэффициентов пересчёта из валют в рубли в формате ключ значение.
1153
1153
  */
1154
1154
  s(this, "currencyRates");
1155
- this.isHidden = (e == null ? void 0 : e.isHidden) ?? !1, this.parentCategoryId = e == null ? void 0 : e.parentCategoryId, this.properties = e == null ? void 0 : e.properties, this.type = "category", this.currencyRates = e != null && e.currencyRates ? Object.fromEntries(Object.entries(e.currencyRates).map(([t, i]) => [Br(t), i])) : void 0;
1155
+ this.isHidden = (e == null ? void 0 : e.isHidden) ?? !1, this.parentCategoryId = e == null ? void 0 : e.parentCategoryId, this.properties = e == null ? void 0 : e.properties, this.type = "category", this.currencyRates = e != null && e.currencyRates ? Object.fromEntries(Object.entries(e.currencyRates).map(([t, i]) => [Mr(t), i])) : void 0;
1156
1156
  }
1157
1157
  }
1158
1158
  class wr extends J {
@@ -1231,7 +1231,7 @@ class wr extends J {
1231
1231
  * @inheritDoc
1232
1232
  */
1233
1233
  s(this, "replacementId");
1234
- this.product = new B(e.product), this.quantity = e.quantity ?? 0, this.marker = e.marker, this.category = e.category ?? new ve(), this.currency = e.currency ? new x(e.currency) : void 0, this.height = e.height, this.length = e.length, this.width = e.width, this.configurator = e.configurator, this.configuratorParams = e.configuratorParams && jr(e.configuratorParams), this.isAdditionalSale = e.isAdditionalSale, this.creator = e.creator && new I(e.creator), this.isRemoved = e.isRemoved, this.ord = e.ord, this.onOrder = e.onOrder, this.originalId = e.originalId, this.replacementId = e.replacementId;
1234
+ this.product = new M(e.product), this.quantity = e.quantity ?? 0, this.marker = e.marker, this.category = e.category ?? new ve(), this.currency = e.currency ? new x(e.currency) : void 0, this.height = e.height, this.length = e.length, this.width = e.width, this.configurator = e.configurator, this.configuratorParams = e.configuratorParams && jr(e.configuratorParams), this.isAdditionalSale = e.isAdditionalSale, this.creator = e.creator && new I(e.creator), this.isRemoved = e.isRemoved, this.ord = e.ord, this.onOrder = e.onOrder, this.originalId = e.originalId, this.replacementId = e.replacementId;
1235
1235
  }
1236
1236
  }
1237
1237
  let vr = class extends wr {
@@ -1890,7 +1890,7 @@ class Re extends ft {
1890
1890
  * Список продуктов категории.
1891
1891
  */
1892
1892
  s(this, "products");
1893
- this.categories = (t = e == null ? void 0 : e.categories) == null ? void 0 : t.map((o) => new Re(o)), this.products = (i = e == null ? void 0 : e.products) == null ? void 0 : i.map((o) => new B(o));
1893
+ this.categories = (t = e == null ? void 0 : e.categories) == null ? void 0 : t.map((o) => new Re(o)), this.products = (i = e == null ? void 0 : e.products) == null ? void 0 : i.map((o) => new M(o));
1894
1894
  }
1895
1895
  }
1896
1896
  class Pr {
@@ -2233,7 +2233,7 @@ class Yt {
2233
2233
  return Object.keys(this).forEach((c) => {
2234
2234
  const u = this[c];
2235
2235
  // eslint-disable-next-line prettier/prettier
2236
- $(u) || a(u) && u.trim().length === 0 || Me(u.isNewRec) && u.isNewRec() || (r[c] = u);
2236
+ $(u) || a(u) && u.trim().length === 0 || Be(u.isNewRec) && u.isNewRec() || (r[c] = u);
2237
2237
  }), !((e = r == null ? void 0 : r.createdAt) != null && e.from) && !((t = r == null ? void 0 : r.createdAt) != null && t.to) && delete r.createdAt, !((i = r == null ? void 0 : r.updatedAt) != null && i.from) && !((o = r == null ? void 0 : r.updatedAt) != null && o.to) && delete r.updatedAt, r;
2238
2238
  }
2239
2239
  }
@@ -2449,7 +2449,7 @@ class Zt extends h {
2449
2449
  price_coefficient_id: (i = t.coefficient) == null ? void 0 : i.id,
2450
2450
  increase_percent: t.value
2451
2451
  },
2452
- (o) => new B(o.data)
2452
+ (o) => new M(o.data)
2453
2453
  );
2454
2454
  }
2455
2455
  /**
@@ -2461,7 +2461,7 @@ class Zt extends h {
2461
2461
  * @see /doc/api/internal#/operations/api_internal_client_price_products_remove
2462
2462
  */
2463
2463
  removeProductPrice(r, e) {
2464
- return this.delete(`/internal/clients/${r}/price/products/${e}`, (t) => new B(t.data));
2464
+ return this.delete(`/internal/clients/${r}/price/products/${e}`, (t) => new M(t.data));
2465
2465
  }
2466
2466
  /**
2467
2467
  * Добавляет указанный продукт в список товаров для дополнительных продаж.
@@ -2816,7 +2816,7 @@ class ss extends h {
2816
2816
  showHidden: i,
2817
2817
  withPriceCoefficients: t
2818
2818
  },
2819
- (o) => ye(o.data, (c) => new B(c))
2819
+ (o) => ye(o.data, (c) => new M(c))
2820
2820
  );
2821
2821
  }
2822
2822
  }
@@ -2837,7 +2837,7 @@ class is extends h {
2837
2837
  clientId: e,
2838
2838
  withPriceCoefficients: t
2839
2839
  },
2840
- (i) => new B(i.data)
2840
+ (i) => new M(i.data)
2841
2841
  );
2842
2842
  }
2843
2843
  }
@@ -2873,7 +2873,7 @@ class tr {
2873
2873
  field: this.field,
2874
2874
  op: this.op
2875
2875
  };
2876
- return qe(this.value) ? e.value = L(this.value, r) : Be(this.value) ? e.value = {
2876
+ return qe(this.value) ? e.value = L(this.value, r) : Me(this.value) ? e.value = {
2877
2877
  from: this.value.from ? L(this.value.from, r) : null,
2878
2878
  to: this.value.to ? L(this.value.to, r) : null
2879
2879
  } : e.value = this.value, e;
@@ -2909,7 +2909,7 @@ class j {
2909
2909
  toPrimitive() {
2910
2910
  return {
2911
2911
  groupOp: this.groupOp,
2912
- filters: this.filters.map((r) => r instanceof tr && Me(r.toPrimitive) ? r.toPrimitive() : r),
2912
+ filters: this.filters.map((r) => r instanceof tr && Be(r.toPrimitive) ? r.toPrimitive() : r),
2913
2913
  groups: this.groups.map((r) => r instanceof j ? r.toPrimitive() : r)
2914
2914
  };
2915
2915
  }
@@ -4077,7 +4077,7 @@ class Qe {
4077
4077
  return Object.keys(this).forEach((e) => {
4078
4078
  const t = this[e];
4079
4079
  $(t) || // eslint-disable-next-line prettier/prettier,lodash/prefer-lodash-method
4080
- a(t) && t.trim().length === 0 || Me(t.isNewRec) && t.isNewRec() || (r[e] = t);
4080
+ a(t) && t.trim().length === 0 || Be(t.isNewRec) && t.isNewRec() || (r[e] = t);
4081
4081
  }), r;
4082
4082
  }
4083
4083
  }
@@ -5605,7 +5605,7 @@ class dt extends wr {
5605
5605
  * Продукт, которым заменена текущая запись.
5606
5606
  */
5607
5607
  s(this, "replacement");
5608
- this.product = new B(e.product), this.currency = new x(e.currency), this.cost = e.cost, this.costOne = e.costOne, this.costOneRub = e.costOneRub, this.costRub = e.costRub, this.logicGroupId = e.logicGroupId, this.salesDirection = e.salesDirection, this.specificationImgUrl = e.specificationImgUrl, this.sawing = e.sawing, t && (this.replacement = t, this.quantity !== t.quantity && this.changedFields.push("quantity"), this.length !== t.length && this.changedFields.push("length"));
5608
+ this.product = new M(e.product), this.currency = new x(e.currency), this.cost = e.cost, this.costOne = e.costOne, this.costOneRub = e.costOneRub, this.costRub = e.costRub, this.logicGroupId = e.logicGroupId, this.salesDirection = e.salesDirection, this.specificationImgUrl = e.specificationImgUrl, this.sawing = e.sawing, t && (this.replacement = t, this.quantity !== t.quantity && this.changedFields.push("quantity"), this.length !== t.length && this.changedFields.push("length"));
5609
5609
  }
5610
5610
  }
5611
5611
  class b extends Ir {
@@ -5848,6 +5848,17 @@ class Cs extends Ce {
5848
5848
  deleteOfferProduct(r, e) {
5849
5849
  return this.delete(`/internal/orders/offers/${r}/products/${e}`, (t) => new X(t.data));
5850
5850
  }
5851
+ /**
5852
+ * Возвращает содержимое печатной формы заказа-черновика в формате HTML.
5853
+ *
5854
+ * @param offerId Идентификатор записи заказа-черновика.
5855
+ * @param recipientText Текст блока «Кому» в документе.
5856
+ *
5857
+ * @see /doc/api/internal#/Заказы/api_internal_order_commercial_offer_view_html
5858
+ */
5859
+ getOfferHtml(r, e) {
5860
+ return this.get(`/internal/orders/offers/${r}/view`, e ? { recipientText: e } : {}, (t) => new Blob([t.data], { type: "text/html" }));
5861
+ }
5851
5862
  /**
5852
5863
  * Возвращает файл заказа-черновика в формате PDF.
5853
5864
  *
@@ -6546,7 +6557,7 @@ const xe = (n) => {
6546
6557
  salesDirections: (o = n.salesDirections) == null ? void 0 : o.map((c) => c.id),
6547
6558
  hideNotActive: n.hideNotActive
6548
6559
  },
6549
- (c) => $(c) || (H(c) || Be(c)) && re(c)
6560
+ (c) => $(c) || (H(c) || Me(c)) && re(c)
6550
6561
  ) : {};
6551
6562
  }, or = (n) => {
6552
6563
  const r = {};
@@ -6695,7 +6706,7 @@ class As extends h {
6695
6706
  to: qe((u = r.costDate) == null ? void 0 : u.to) ? L(r.costDate.to, e) : (p = r.costDate) == null ? void 0 : p.to
6696
6707
  }
6697
6708
  }),
6698
- (f) => $(f) || (H(f) || Be(f)) && re(f)
6709
+ (f) => $(f) || (H(f) || Me(f)) && re(f)
6699
6710
  ), i = ((m = r.product) == null ? void 0 : m[0]) ?? 0;
6700
6711
  return delete t.product, this.get(`/internal/price/products/${i}/history`, t).then((f) => [
6701
6712
  new bt(he(f[0], { history: f }))
@@ -7473,7 +7484,7 @@ export {
7473
7484
  O as ClientDataProvider,
7474
7485
  Zt as ClientPriceProvider,
7475
7486
  es as ClientPriceTemplateProvider,
7476
- B as ClientProduct,
7487
+ M as ClientProduct,
7477
7488
  ss as ClientProductCategoryDataProvider,
7478
7489
  is as ClientProductDataProvider,
7479
7490
  V as ClientShortInfo,
@@ -7518,7 +7529,7 @@ export {
7518
7529
  h as HttpRequester,
7519
7530
  J as Identity,
7520
7531
  ht as Image,
7521
- M as JwtPayload,
7532
+ B as JwtPayload,
7522
7533
  ae as Manager,
7523
7534
  Je as ManagerCommon,
7524
7535
  vs as ManagerDataFactory,