@snabcentr/common-lib 1.74.0 → 1.74.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-DOnuNRqnK/G4RF2avkSOPrv75zBRa7n5/UhFSAkFhsCNeXD/7+iUzvpjlwDhDyNb"
7
+ "integrity": "sha384-OCb0B5rV1EGDo3JjyqgUf+vVykJ2cbr+f28Z467Bj80kJkHJtqr6xQ22UiXlH5Rv"
8
8
  }
9
9
  }
@@ -6,8 +6,8 @@ import { merge as ye, isUndefined as ar, isNil as A, isEmpty as Y, noop as w, ma
6
6
  import { objectToCamel as Fe, objectToSnake as ze } from "ts-case-convert";
7
7
  import { isAfter as We, parseISO as v, startOfToday as de, format as O, addSeconds as Or, addBusinessDays as qr, endOfTomorrow as Nr, startOfTomorrow as Ur, endOfYesterday as Fr, startOfYesterday as Mr, endOfToday as jr, endOfDay as Gr, startOfDay as Br } from "date-fns";
8
8
  import { defineStore as te } from "pinia";
9
- import { ref as y, markRaw as Er, computed as R } from "vue";
10
- import Hr from "axios";
9
+ import { ref as y, markRaw as Hr, computed as R } from "vue";
10
+ import Er from "axios";
11
11
  class N {
12
12
  /**
13
13
  * Инициализирует экземпляр класса {@link JwtPayload}.
@@ -308,7 +308,7 @@ function Je(n) {
308
308
  return;
309
309
  }
310
310
  }
311
- const E = te("__auth_state_private", () => {
311
+ const H = te("__auth_state_private", () => {
312
312
  const n = y(
313
313
  (() => {
314
314
  var u;
@@ -321,7 +321,7 @@ const E = te("__auth_state_private", () => {
321
321
  const c = (u = $.getConfig().devMode) == null ? void 0 : u.initAuthBearerToken;
322
322
  return c ? Promise.resolve(c) : void 0;
323
323
  })()
324
- ), r = y(void 0), e = y(void 0), s = Er(/* @__PURE__ */ new Map());
324
+ ), r = y(void 0), e = y(void 0), s = Hr(/* @__PURE__ */ new Map());
325
325
  function i() {
326
326
  e.value = void 0, A(n.value) || n.value.then((o) => {
327
327
  const c = N.getJwtPayload(o);
@@ -352,7 +352,7 @@ const E = te("__auth_state_private", () => {
352
352
  };
353
353
  }), ae = te("__auth_state", () => {
354
354
  const n = R(() => {
355
- const o = E();
355
+ const o = H();
356
356
  if (A(o.jwtToken) && !A(o.jwtTokenUpdater)) {
357
357
  const c = o.jwtTokenUpdater();
358
358
  o.jwtToken = c, c.then((u) => {
@@ -362,18 +362,18 @@ const E = te("__auth_state_private", () => {
362
362
  return o.jwtToken;
363
363
  });
364
364
  function r(o) {
365
- E().jwtTokenUpdater = o;
365
+ H().jwtTokenUpdater = o;
366
366
  }
367
367
  function e(o) {
368
- const c = E();
368
+ const c = H();
369
369
  c.jwtToken = Promise.resolve(o), fe.saveActualDataToStorage("sc.token", o, Je(o)), c.recalculateUserPermissions();
370
370
  }
371
371
  function s() {
372
- const o = E();
372
+ const o = H();
373
373
  o.jwtToken = void 0, o.userPermissions = void 0, fe.saveActualDataToStorage("sc.token", void 0);
374
374
  }
375
375
  function i(o) {
376
- const c = E();
376
+ const c = H();
377
377
  !A(c.jwtToken) && A(c.userPermissions) && c.jwtToken.then((f) => {
378
378
  const g = N.getJwtPayload(f);
379
379
  c.userPermissions = g.exp * 1e3 > Date.now() ? ir(g.resourceAccess, (a) => (a == null ? void 0 : a.roles) ?? []) : void 0;
@@ -387,7 +387,7 @@ const E = te("__auth_state_private", () => {
387
387
  const a = Ir(g, ".");
388
388
  if (a.length < 2)
389
389
  return !1;
390
- const [_, d] = a, G = (B = E().userPermissions) == null ? void 0 : B[_];
390
+ const [_, d] = a, G = (B = H().userPermissions) == null ? void 0 : B[_];
391
391
  return Q(G) && G.includes(d);
392
392
  };
393
393
  return Q(o) ? Sr(o, (g) => f(g)) : f(o);
@@ -1027,7 +1027,7 @@ const S = class S {
1027
1027
  // eslint-disable-next-line class-methods-use-this
1028
1028
  t(this, "dataConverterResponseInterceptor", (r) => (r.data && (r.data = Fe(r.data)), r));
1029
1029
  const r = $.getConfig().version;
1030
- this.errorResponseHandler = S.defaultErrorsResponseHandler, this.httpClient = Hr.create({
1030
+ this.errorResponseHandler = S.defaultErrorsResponseHandler, this.httpClient = Er.create({
1031
1031
  headers: {
1032
1032
  "APP-VERSION": `${r.name} (${r.version}, ${O(r.date, $.getConfig().dateFormats.uiDate)})`,
1033
1033
  Accept: "application/json",
@@ -1682,7 +1682,7 @@ class le extends P {
1682
1682
  e && (this.country = new ee(e.country));
1683
1683
  }
1684
1684
  }
1685
- class Ee extends P {
1685
+ class He extends P {
1686
1686
  /**
1687
1687
  * Инициализирует экземпляр класса {@link CityWithRegionAndCountry}.
1688
1688
  *
@@ -1782,7 +1782,7 @@ class ge extends fr {
1782
1782
  * @inheritDoc
1783
1783
  */
1784
1784
  t(this, "curators");
1785
- this.salesDirection = new x(e == null ? void 0 : e.salesDirection), this.debt = (e == null ? void 0 : e.debt) ?? 0, this.alternativeName = (e == null ? void 0 : e.alternativeName) ?? "", this.city = new Ee(e == null ? void 0 : e.city), this.comment = e == null ? void 0 : e.comment, this.isPhoneApproved = (e == null ? void 0 : e.isPhoneApproved) ?? !1, this.isEmailApproved = (e == null ? void 0 : e.isEmailApproved) ?? !1, this.managers = ((s = e == null ? void 0 : e.managers) == null ? void 0 : s.map((o) => new ce(o))) ?? [], this.curators = ((i = e == null ? void 0 : e.curators) == null ? void 0 : i.map((o) => new mr(o))) ?? [];
1785
+ this.salesDirection = new x(e == null ? void 0 : e.salesDirection), this.debt = (e == null ? void 0 : e.debt) ?? 0, this.alternativeName = (e == null ? void 0 : e.alternativeName) ?? "", this.city = new He(e == null ? void 0 : e.city), this.comment = e == null ? void 0 : e.comment, this.isPhoneApproved = (e == null ? void 0 : e.isPhoneApproved) ?? !1, this.isEmailApproved = (e == null ? void 0 : e.isEmailApproved) ?? !1, this.managers = ((s = e == null ? void 0 : e.managers) == null ? void 0 : s.map((o) => new ce(o))) ?? [], this.curators = ((i = e == null ? void 0 : e.curators) == null ? void 0 : i.map((o) => new mr(o))) ?? [];
1786
1786
  }
1787
1787
  }
1788
1788
  class se extends j {
@@ -1852,7 +1852,7 @@ class ie extends b {
1852
1852
  this.type = new yr(e == null ? void 0 : e.type), this.description = (e == null ? void 0 : e.description) ?? "", this.metadata = e == null ? void 0 : e.metadata;
1853
1853
  }
1854
1854
  }
1855
- class H {
1855
+ class E {
1856
1856
  /**
1857
1857
  * Инициализирует экземпляр класса {@link PropertyValue}.
1858
1858
  *
@@ -2448,7 +2448,7 @@ class Bt extends p {
2448
2448
  return this.post(`/internal/clients/${r}/price/commercial-offer/send`, e);
2449
2449
  }
2450
2450
  }
2451
- class Et extends p {
2451
+ class Ht extends p {
2452
2452
  /**
2453
2453
  * Возвращает список шаблонов прайс-листа привязанных к клиенту.
2454
2454
  *
@@ -2540,7 +2540,7 @@ class Et extends p {
2540
2540
  return this.delete(`/internal/clients/${r}/price/templates/${e}/${s}`);
2541
2541
  }
2542
2542
  }
2543
- class Ht extends p {
2543
+ class Et extends p {
2544
2544
  /**
2545
2545
  * Возвращает список данных о корневых категориях.
2546
2546
  *
@@ -2765,7 +2765,7 @@ class Jt extends p {
2765
2765
  );
2766
2766
  }
2767
2767
  }
2768
- var He = /* @__PURE__ */ ((n) => (n.BeginWith = "bw", n.Contains = "cn", n.Custom = "custom", n.EndsWith = "ew", n.Equals = "eq", n.GreaterOrEqual = "ge", n.GreaterThan = "gt", n.InList = "in", n.LessOrEqual = "le", n.LessThan = "lt", n.NotBeginWith = "bn", n.NotContains = "nc", n.NotEndsWith = "en", n.NotEqual = "ne", n.NotInList = "ni", n.NotNull = "nn", n.Null = "nu", n))(He || {});
2768
+ var Ee = /* @__PURE__ */ ((n) => (n.BeginWith = "bw", n.Contains = "cn", n.Custom = "custom", n.EndsWith = "ew", n.Equals = "eq", n.GreaterOrEqual = "ge", n.GreaterThan = "gt", n.InList = "in", n.LessOrEqual = "le", n.LessThan = "lt", n.NotBeginWith = "bn", n.NotContains = "nc", n.NotEndsWith = "en", n.NotEqual = "ne", n.NotInList = "ni", n.NotNull = "nn", n.Null = "nu", n))(Ee || {});
2769
2769
  class Ke {
2770
2770
  /**
2771
2771
  * Инициализирует экземпляр класса {@link FilterItem}.
@@ -2785,7 +2785,7 @@ class Ke {
2785
2785
  * Значение с которым сравнивается поле.
2786
2786
  */
2787
2787
  t(this, "value");
2788
- this.field = (r == null ? void 0 : r.field) ?? "", this.op = (r == null ? void 0 : r.op) ?? He.Equals, this.value = (r == null ? void 0 : r.value) ?? "";
2788
+ this.field = (r == null ? void 0 : r.field) ?? "", this.op = (r == null ? void 0 : r.op) ?? Ee.Equals, this.value = (r == null ? void 0 : r.value) ?? "";
2789
2789
  }
2790
2790
  /**
2791
2791
  * Преобразует фильтр в примитивное представление для API.
@@ -3215,7 +3215,7 @@ class Qt extends $e {
3215
3215
  * @see /doc/api/internal#/operations/api_internal_catalog_product_properties_get_list
3216
3216
  */
3217
3217
  getProductProperties(r) {
3218
- return this.get(`/internal/catalog/products/${r}/properties`, {}, (e) => e.data.map((s) => new H(s)));
3218
+ return this.get(`/internal/catalog/products/${r}/properties`, {}, (e) => e.data.map((s) => new E(s)));
3219
3219
  }
3220
3220
  /**
3221
3221
  * Возвращает значение свойства продукта.
@@ -3225,7 +3225,7 @@ class Qt extends $e {
3225
3225
  * @see /doc/api/internal#/operations/api_internal_catalog_product_properties_get
3226
3226
  */
3227
3227
  getProductProperty(r, e) {
3228
- return this.get(`/internal/catalog/products/${r}/properties/${e}`, {}, (s) => new H(s.data));
3228
+ return this.get(`/internal/catalog/products/${r}/properties/${e}`, {}, (s) => new E(s.data));
3229
3229
  }
3230
3230
  /**
3231
3231
  * Обновляет значение свойства продукта.
@@ -3236,7 +3236,7 @@ class Qt extends $e {
3236
3236
  * @see /doc/api/internal#/operations/api_internal_catalog_product_properties_update
3237
3237
  */
3238
3238
  updateProductProperty(r, e, s) {
3239
- return this.patch(`/internal/catalog/products/${r}/properties/${e}`, { value: s }, (i) => new H(i.data));
3239
+ return this.patch(`/internal/catalog/products/${r}/properties/${e}`, { value: s }, (i) => new E(i.data));
3240
3240
  }
3241
3241
  /**
3242
3242
  * Удаляет значение свойства продукта.
@@ -3361,7 +3361,7 @@ class Qt extends $e {
3361
3361
  * @see /doc/api/internal#/operations/api_internal_catalog_category_properties_get_list
3362
3362
  */
3363
3363
  getCategoryProperties(r) {
3364
- return this.get(`/internal/catalog/categories/${r}/properties`, {}, (e) => e.data.map((s) => new H(s)));
3364
+ return this.get(`/internal/catalog/categories/${r}/properties`, {}, (e) => e.data.map((s) => new E(s)));
3365
3365
  }
3366
3366
  /**
3367
3367
  * Возвращает значение свойства категории.
@@ -3371,7 +3371,7 @@ class Qt extends $e {
3371
3371
  * @see /doc/api/internal#/operations/api_internal_catalog_category_properties_get
3372
3372
  */
3373
3373
  getCategoryProperty(r, e) {
3374
- return this.get(`/internal/catalog/categories/${r}/properties/${e}`, {}, (s) => new H(s.data));
3374
+ return this.get(`/internal/catalog/categories/${r}/properties/${e}`, {}, (s) => new E(s.data));
3375
3375
  }
3376
3376
  /**
3377
3377
  * Обновляет значение свойства категории.
@@ -3382,7 +3382,7 @@ class Qt extends $e {
3382
3382
  * @see /doc/api/internal#/operations/api_internal_catalog_category_properties_update
3383
3383
  */
3384
3384
  updateCategoryProperty(r, e, s) {
3385
- return this.patch(`/internal/catalog/categories/${r}/properties/${e}`, { value: s }, (i) => new H(i.data));
3385
+ return this.patch(`/internal/catalog/categories/${r}/properties/${e}`, { value: s }, (i) => new E(i.data));
3386
3386
  }
3387
3387
  /**
3388
3388
  * Удаляет значение свойства категории.
@@ -3541,7 +3541,7 @@ function Ye(n) {
3541
3541
  }
3542
3542
  }), r;
3543
3543
  }
3544
- var ct = /* @__PURE__ */ ((n) => (n.LastOrder = "last_order", n.Contacts = "contacts", n.PartnerGroups = "partner_groups", n.PreferredDeliveryType = "preferred_delivery_type", n.SalesDirection = "sales_direction", n.Managers = "managers", n))(ct || {}), q = /* @__PURE__ */ ((n) => (n.Person = "individual", n.Ic = "entrepreneur", n.UlR = "legal", n.UlNr = "non_resident_legal", n))(q || {});
3544
+ var ct = /* @__PURE__ */ ((n) => (n.LastOrder = "last_order", n.Contacts = "contacts", n.PartnerGroups = "partner_groups", n.PreferredDeliveryType = "preferred_delivery_type", n.SalesDirection = "sales_direction", n.Managers = "managers", n.Curators = "curators", n))(ct || {}), q = /* @__PURE__ */ ((n) => (n.Person = "individual", n.Ic = "entrepreneur", n.UlR = "legal", n.UlNr = "non_resident_legal", n))(q || {});
3545
3545
  class lt extends P {
3546
3546
  }
3547
3547
  class wr extends P {
@@ -4112,7 +4112,7 @@ class Xt {
4112
4112
  */
4113
4113
  t(this, "isExcludedFromMsCallsToClients");
4114
4114
  var e, s, i, o, c, u, h, f;
4115
- this.id = r == null ? void 0 : r.id, this.name = r == null ? void 0 : r.name, this.alternativeName = r == null ? void 0 : r.alternativeName, this.searchTerm = r == null ? void 0 : r.searchTerm, this.cities = (e = r == null ? void 0 : r.cities) == null ? void 0 : e.map((g) => new Ee(g)), this.region = new le(r == null ? void 0 : r.region), this.country = new ee(r == null ? void 0 : r.country), this.phone = r == null ? void 0 : r.phone, this.email = r == null ? void 0 : r.email, this.isActive = r && Object.prototype.hasOwnProperty.call(r, "isActive") ? r == null ? void 0 : r.isActive : !0, this.createdAt = new k(r == null ? void 0 : r.createdAt), this.lastLoginDate = new k(r == null ? void 0 : r.lastLoginDate), this.lastLoginDateHasOrder = (r == null ? void 0 : r.lastLoginDateHasOrder) ?? void 0, this.managers = ((s = r == null ? void 0 : r.managers) == null ? void 0 : s.map((g) => new Te(g))) ?? [], this.curators = ((i = r == null ? void 0 : r.curators) == null ? void 0 : i.map((g) => new mr(g))) ?? [], this.salesDirections = (o = r == null ? void 0 : r.salesDirections) == null ? void 0 : o.map((g) => new x(g)), this.contragentInn = r == null ? void 0 : r.contragentInn, this.contragentType = new F(r == null ? void 0 : r.contragentType), this.preferredDeliveryType = new X(r == null ? void 0 : r.preferredDeliveryType), this.partnerGroups = (c = r == null ? void 0 : r.partnerGroups) == null ? void 0 : c.map((g) => new re(g)), this.contact = new Ne(r == null ? void 0 : r.contact), this.lastOrder = {
4115
+ this.id = r == null ? void 0 : r.id, this.name = r == null ? void 0 : r.name, this.alternativeName = r == null ? void 0 : r.alternativeName, this.searchTerm = r == null ? void 0 : r.searchTerm, this.cities = (e = r == null ? void 0 : r.cities) == null ? void 0 : e.map((g) => new He(g)), this.region = new le(r == null ? void 0 : r.region), this.country = new ee(r == null ? void 0 : r.country), this.phone = r == null ? void 0 : r.phone, this.email = r == null ? void 0 : r.email, this.isActive = r && Object.prototype.hasOwnProperty.call(r, "isActive") ? r == null ? void 0 : r.isActive : !0, this.createdAt = new k(r == null ? void 0 : r.createdAt), this.lastLoginDate = new k(r == null ? void 0 : r.lastLoginDate), this.lastLoginDateHasOrder = (r == null ? void 0 : r.lastLoginDateHasOrder) ?? void 0, this.managers = ((s = r == null ? void 0 : r.managers) == null ? void 0 : s.map((g) => new Te(g))) ?? [], this.curators = ((i = r == null ? void 0 : r.curators) == null ? void 0 : i.map((g) => new mr(g))) ?? [], this.salesDirections = (o = r == null ? void 0 : r.salesDirections) == null ? void 0 : o.map((g) => new x(g)), this.contragentInn = r == null ? void 0 : r.contragentInn, this.contragentType = new F(r == null ? void 0 : r.contragentType), this.preferredDeliveryType = new X(r == null ? void 0 : r.preferredDeliveryType), this.partnerGroups = (c = r == null ? void 0 : r.partnerGroups) == null ? void 0 : c.map((g) => new re(g)), this.contact = new Ne(r == null ? void 0 : r.contact), this.lastOrder = {
4116
4116
  createdAt: new k((u = r == null ? void 0 : r.lastOrder) == null ? void 0 : u.createdAt),
4117
4117
  creator: (h = r == null ? void 0 : r.lastOrder) == null ? void 0 : h.creator,
4118
4118
  isApproved: (f = r == null ? void 0 : r.lastOrder) == null ? void 0 : f.isApproved
@@ -4483,7 +4483,7 @@ class L extends $e {
4483
4483
  return this.getClientsList({
4484
4484
  groupOp: "and",
4485
4485
  groups: [],
4486
- filters: [{ field: "phone", op: He.Contains, value: r }]
4486
+ filters: [{ field: "phone", op: Ee.Contains, value: r }]
4487
4487
  });
4488
4488
  }
4489
4489
  /**
@@ -5786,7 +5786,7 @@ class T extends pe {
5786
5786
  * @param term Терм поиска.
5787
5787
  */
5788
5788
  searchCity(r) {
5789
- return this.getTypedDataArrayRequester(Ee, `/internal/references/city-with-region-and-country/search?term=${r}`);
5789
+ return this.getTypedDataArrayRequester(He, `/internal/references/city-with-region-and-country/search?term=${r}`);
5790
5790
  }
5791
5791
  /**
5792
5792
  * Выполняет поиск данных о регионах по терму в названии.
@@ -6318,13 +6318,13 @@ export {
6318
6318
  Ve as CategoryPricingRule,
6319
6319
  wr as ChannelPrimaryInterest,
6320
6320
  Yt as City,
6321
- Ee as CityWithRegionAndCountry,
6321
+ He as CityWithRegionAndCountry,
6322
6322
  Xe as Client,
6323
6323
  Ct as ClientAdditionalData,
6324
6324
  we as ClientCategory,
6325
6325
  L as ClientDataProvider,
6326
6326
  Bt as ClientPriceProvider,
6327
- Et as ClientPriceTemplateProvider,
6327
+ Ht as ClientPriceTemplateProvider,
6328
6328
  Z as ClientProduct,
6329
6329
  Wt as ClientProductCategoryDataProvider,
6330
6330
  Jt as ClientProductDataProvider,
@@ -6364,7 +6364,7 @@ export {
6364
6364
  fs as FieldValidationResultData,
6365
6365
  ue as FilterGroup,
6366
6366
  Ke as FilterItem,
6367
- He as FilterOpEnum,
6367
+ Ee as FilterOpEnum,
6368
6368
  ur as GeoCoordinates,
6369
6369
  Wr as HiddenCatalogableItem,
6370
6370
  pe as HttpCachedRequester,
@@ -6407,7 +6407,7 @@ export {
6407
6407
  Kt as PricingRoleProvider,
6408
6408
  Oe as PrimaryCatalogableItem,
6409
6409
  I as Product,
6410
- Ht as ProductCategoryDataProvider,
6410
+ Et as ProductCategoryDataProvider,
6411
6411
  zt as ProductDataProvider,
6412
6412
  mt as ProductFileType,
6413
6413
  Me as ProductPriceCoefficient,
@@ -6416,7 +6416,7 @@ export {
6416
6416
  ie as Property,
6417
6417
  yr as PropertyType,
6418
6418
  Yr as PropertyTypeEnum,
6419
- H as PropertyValue,
6419
+ E as PropertyValue,
6420
6420
  ls as RecommendationsDataProvider,
6421
6421
  rr as RecommendationsList,
6422
6422
  P as Reference,