@snabcentr/common-lib 2.2.0 → 2.2.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-WcXDehLmu6N7LZEg1aqMdwpVRZGHTlNBa3AS04mOF6k921kE0X3BW06zYLDqlrt6"
7
+ "integrity": "sha384-NJ32dI1wmp64MTf6yAjCb3EFUcQNu+CFmTZtDviIMQZ1nYyNolHijbczK1I2CvJp"
8
8
  }
9
9
  }
@@ -2,9 +2,9 @@ var $r = Object.defineProperty;
2
2
  var br = (n, r, e) => r in n ? $r(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
3
3
  var t = (n, r, e) => br(n, typeof r != "symbol" ? r + "" : r, e);
4
4
  import { jwtDecode as sr } from "jwt-decode";
5
- import { merge as Ne, isUndefined as Sr, isNil as A, isEmpty as Y, noop as w, mapValues as ir, isArray as Q, every as ar, split as Ir, toUpper as xr, constant as Lr, isString as C, cloneDeep as kr, toLower as _r, isFunction as Ue, map as he, forEach as Or, isDate as ke, omitBy as nr, isObject as or } from "lodash-es";
5
+ import { merge as Ne, isUndefined as Sr, isNil as A, isEmpty as Y, noop as w, mapValues as ir, isArray as Q, every as ar, split as Ir, toUpper as xr, constant as Lr, isString as C, cloneDeep as kr, toLower as _r, isFunction as Ue, map as he, forEach as dr, isDate as ke, omitBy as nr, isObject as or } from "lodash-es";
6
6
  import { objectToCamel as Fe, objectToSnake as ze } from "ts-case-convert";
7
- import { isAfter as We, parseISO as v, startOfToday as _e, format as d, addSeconds as dr, addBusinessDays as qr, endOfTomorrow as Nr, startOfTomorrow as Ur, endOfYesterday as Fr, startOfYesterday as Mr, endOfToday as jr, endOfDay as Gr, startOfDay as Hr } from "date-fns";
7
+ import { isAfter as We, parseISO as v, startOfToday as _e, 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 Hr } from "date-fns";
8
8
  import { defineStore as te } from "pinia";
9
9
  import { ref as y, markRaw as Br, computed as R } from "vue";
10
10
  import Er from "axios";
@@ -387,8 +387,8 @@ const B = te("__auth_state_private", () => {
387
387
  const S = Ir(m, ".");
388
388
  if (S.length < 2)
389
389
  return !1;
390
- const [_, O] = S, G = (H = B().userPermissions) == null ? void 0 : H[_];
391
- return Q(G) && G.includes(O);
390
+ const [_, d] = S, G = (H = B().userPermissions) == null ? void 0 : H[_];
391
+ return Q(G) && G.includes(d);
392
392
  };
393
393
  return Q(o) ? ar(o, (m) => f(m)) : f(o);
394
394
  });
@@ -497,7 +497,7 @@ class cr extends oe {
497
497
  this.slug = (e == null ? void 0 : e.slug) ?? "";
498
498
  }
499
499
  }
500
- class Oe extends cr {
500
+ class de extends cr {
501
501
  /**
502
502
  * Инициализирует экземпляр класса {@link PrimaryCatalogableItem}.
503
503
  *
@@ -512,7 +512,7 @@ class Oe extends cr {
512
512
  this.isPrimary = (e == null ? void 0 : e.isPrimary) ?? !1;
513
513
  }
514
514
  }
515
- class ge extends Oe {
515
+ class ge extends de {
516
516
  /**
517
517
  * Инициализирует экземпляр класса {@link BaseCategory}.
518
518
  *
@@ -792,7 +792,7 @@ class I extends Wr {
792
792
  t(this, "priceCoefficients");
793
793
  this.supplierSku = e == null ? void 0 : e.supplierSku, this.unit = (e == null ? void 0 : e.unit) ?? "", this.pack = e == null ? void 0 : e.pack, this.minCount = e == null ? void 0 : e.minCount, this.quantityUnit = e == null ? void 0 : e.quantityUnit, this.currency = (e == null ? void 0 : e.currency) ?? "", this.cost = (e == null ? void 0 : e.cost) ?? 0, this.costRub = (e == null ? void 0 : e.costRub) ?? 0, this.costDate = C(e == null ? void 0 : e.costDate) ? v(e.costDate) : e == null ? void 0 : e.costDate, this.onOrder = (e == null ? void 0 : e.onOrder) ?? !1, this.stockCount = ((i = e == null ? void 0 : e.stockCount) == null ? void 0 : i.map((p) => new zr(p))) ?? [], this.currencySignature = (e == null ? void 0 : e.currencySignature) ?? "", this.type = "product";
794
794
  const s = (e == null ? void 0 : e.category) ?? ((o = e == null ? void 0 : e.categories) == null ? void 0 : o.find((p) => p.isPrimary));
795
- s && (this.category = new Oe({ ...s, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((p) => new Oe(p))), this.images = ((c = e == null ? void 0 : e.images) == null ? void 0 : c.map((p) => new Jr(p, T.getConfig().http.mediaUrl))) ?? [], this.properties = (e == null ? void 0 : e.properties) ?? {}, this.retailCost = e == null ? void 0 : e.retailCost, this.retailCostRub = e == null ? void 0 : e.retailCostRub, this.priceCoefficients = ((u = e == null ? void 0 : e.priceCoefficients) == null ? void 0 : u.map((p) => new Me(p))) ?? [], e && "codeNumber" in e && !e.code && (this.code = e == null ? void 0 : e.codeNumber);
795
+ s && (this.category = new de({ ...s, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((p) => new de(p))), this.images = ((c = e == null ? void 0 : e.images) == null ? void 0 : c.map((p) => new Jr(p, T.getConfig().http.mediaUrl))) ?? [], this.properties = (e == null ? void 0 : e.properties) ?? {}, this.retailCost = e == null ? void 0 : e.retailCost, this.retailCostRub = e == null ? void 0 : e.retailCostRub, this.priceCoefficients = ((u = e == null ? void 0 : e.priceCoefficients) == null ? void 0 : u.map((p) => new Me(p))) ?? [], e && "codeNumber" in e && !e.code && (this.code = e == null ? void 0 : e.codeNumber);
796
796
  }
797
797
  /**
798
798
  * Возвращает признак, что это измеряемый товар.
@@ -1029,7 +1029,7 @@ const a = class a {
1029
1029
  const r = T.getConfig().version;
1030
1030
  this.errorResponseHandler = a.defaultErrorsResponseHandler, this.httpClient = Er.create({
1031
1031
  headers: {
1032
- "APP-VERSION": `${r.name} (${r.version}, ${d(r.date, T.getConfig().dateFormats.uiDate)})`,
1032
+ "APP-VERSION": `${r.name} (${r.version}, ${O(r.date, T.getConfig().dateFormats.uiDate)})`,
1033
1033
  Accept: "application/json",
1034
1034
  "Content-Type": "application/json"
1035
1035
  }
@@ -2495,8 +2495,8 @@ class Bt extends h {
2495
2495
  return this.post(
2496
2496
  `/internal/clients/${r}/price/templates/${e}`,
2497
2497
  s && {
2498
- startAt: s.startAt && d(s.startAt, i),
2499
- endAt: s.endAt && d(s.endAt, i)
2498
+ startAt: s.startAt && O(s.startAt, i),
2499
+ endAt: s.endAt && O(s.endAt, i)
2500
2500
  },
2501
2501
  (o) => new se(o.data),
2502
2502
  {},
@@ -2529,8 +2529,8 @@ class Bt extends h {
2529
2529
  return this.patch(
2530
2530
  `/internal/clients/${r}/price/templates/${e}/${s}`,
2531
2531
  i && {
2532
- startAt: i.startAt && d(i.startAt, o),
2533
- endAt: i.endAt && d(i.endAt, o)
2532
+ startAt: i.startAt && O(i.startAt, o),
2533
+ endAt: i.endAt && O(i.endAt, o)
2534
2534
  },
2535
2535
  (c) => new se(c.data)
2536
2536
  );
@@ -2621,7 +2621,7 @@ class Et extends h {
2621
2621
  getCategoryProductsCoefficients(r) {
2622
2622
  return this.get(`/internal/catalog/categories/${r}/products/coefficients`, {}, (e) => {
2623
2623
  const { data: s } = e;
2624
- return Or(s, (i) => i.map((o) => new Me(o))), s;
2624
+ return dr(s, (i) => i.map((o) => new Me(o))), s;
2625
2625
  });
2626
2626
  }
2627
2627
  /**
@@ -2805,7 +2805,7 @@ class Ke {
2805
2805
  field: this.field,
2806
2806
  op: this.op
2807
2807
  };
2808
- return r.value = ke(this.value) ? d(this.value, T.getConfig().dateFormats.api) : this.value, r;
2808
+ return r.value = ke(this.value) ? O(this.value, T.getConfig().dateFormats.api) : this.value, r;
2809
2809
  }
2810
2810
  }
2811
2811
  class ue {
@@ -3604,7 +3604,7 @@ class Cr extends P {
3604
3604
  }
3605
3605
  class vr extends P {
3606
3606
  }
3607
- class de extends j {
3607
+ class Oe extends j {
3608
3608
  /**
3609
3609
  * Инициализирует экземпляр класса {@link BankAccount}.
3610
3610
  *
@@ -3756,7 +3756,7 @@ class Pr extends b {
3756
3756
  if (e.bankAccounts) {
3757
3757
  const s = [];
3758
3758
  e.bankAccounts.forEach((i) => {
3759
- s.push(new de(i));
3759
+ s.push(new Oe(i));
3760
3760
  }), this.bankAccounts = s;
3761
3761
  }
3762
3762
  }
@@ -4348,7 +4348,7 @@ class L extends Te {
4348
4348
  * @param contragent Данные о контрагенте клиента.
4349
4349
  */
4350
4350
  static transformContragentClientDataToRequest(r) {
4351
- var c, u, p, f, m, S, _, O;
4351
+ var c, u, p, f, m, S, _, d;
4352
4352
  let e;
4353
4353
  const s = r, i = r, o = r;
4354
4354
  switch (r.opf.slug) {
@@ -4414,7 +4414,7 @@ class L extends Te {
4414
4414
  name: r.name,
4415
4415
  alternative_name: r.alternativeName,
4416
4416
  partner_group_id: (_ = r.partnerGroup) == null ? void 0 : _.id,
4417
- manager_id: (O = r.manager) == null ? void 0 : O.id,
4417
+ manager_id: (d = r.manager) == null ? void 0 : d.id,
4418
4418
  comment: r.comment
4419
4419
  };
4420
4420
  break;
@@ -4754,7 +4754,7 @@ class L extends Te {
4754
4754
  return this.post(
4755
4755
  `/internal/clients/${r}/contragents/${e}/bank-accounts`,
4756
4756
  L.transformClientContragentBankAccountToRequest(s),
4757
- (o) => new de(o.data),
4757
+ (o) => new Oe(o.data),
4758
4758
  i
4759
4759
  );
4760
4760
  }
@@ -4771,7 +4771,7 @@ class L extends Te {
4771
4771
  return this.patch(
4772
4772
  `/internal/clients/${r}/contragents/${e}/bank-accounts/${s.id}`,
4773
4773
  L.transformClientContragentBankAccountToRequest(s),
4774
- (o) => new de(o.data),
4774
+ (o) => new Oe(o.data),
4775
4775
  i
4776
4776
  );
4777
4777
  }
@@ -5025,7 +5025,7 @@ const V = class V extends h {
5025
5025
  */
5026
5026
  cacheResponse(e, s) {
5027
5027
  V.responseDataCache.set(e, {
5028
- validTo: dr(/* @__PURE__ */ new Date(), this.responseDataCacheTimeout),
5028
+ validTo: Or(/* @__PURE__ */ new Date(), this.responseDataCacheTimeout),
5029
5029
  val: s
5030
5030
  });
5031
5031
  }
@@ -5071,17 +5071,19 @@ class ts extends h {
5071
5071
  * Возвращает настройки указанного конфигуратора для указанной категории.
5072
5072
  *
5073
5073
  * @param category Данные о категории.
5074
+ * @param clientId Идентификатор клиента.
5074
5075
  *
5075
5076
  * @see /doc/api/internal#/Каталог/api_internal_catalog_categories_configurator_settings
5076
5077
  */
5077
- getConfiguratorSettings(r) {
5078
- var e;
5079
- return this.get(`internal/catalog/categories/${r.id}/configurators/${(e = r.properties) == null ? void 0 : e.configurator}/settings`);
5078
+ getConfiguratorSettings(r, e) {
5079
+ var s;
5080
+ return this.get(`internal/catalog/categories/${r.id}/configurators/${(s = r.properties) == null ? void 0 : s.configurator}/settings?client_id=${e}`);
5080
5081
  }
5081
5082
  /**
5082
5083
  * Возвращает данные о продукте, который соответствует указанной в запросе конфигурации для указанного конфигуратора.
5083
5084
  *
5084
5085
  * @param category Данные о категории.
5086
+ * @param clientId Идентификатор клиента.
5085
5087
  * @param params Параметры конфигуратора для поиска товара.
5086
5088
  * @param validationFieldResultData Список полей, для которых необходимо
5087
5089
  * установить данные об ошибках валидации
@@ -5089,21 +5091,22 @@ class ts extends h {
5089
5091
  *
5090
5092
  * @see /doc/api/internal#/Каталог/api_internal_catalog_categories_configurator_products_get
5091
5093
  */
5092
- searchProduct(r, e, s = {}) {
5093
- var o;
5094
- const i = this.get(
5095
- `internal/catalog/categories/${r.id}/configurators/${(o = r.properties) == null ? void 0 : o.configurator}/product`,
5096
- { params: e },
5097
- (c) => new I(c.data)
5094
+ searchProduct(r, e, s, i = {}) {
5095
+ var c;
5096
+ const o = this.get(
5097
+ `internal/catalog/categories/${r.id}/configurators/${(c = r.properties) == null ? void 0 : c.configurator}/product`,
5098
+ { params: s, client_id: e },
5099
+ (u) => new I(u.data)
5098
5100
  );
5099
- return i.catch((c) => {
5100
- this.errorResponseHandler(c, s);
5101
- }), i;
5101
+ return o.catch((u) => {
5102
+ this.errorResponseHandler(u, i);
5103
+ }), o;
5102
5104
  }
5103
5105
  /**
5104
5106
  * Создает пользовательский шаблон конфигуратора.
5105
5107
  *
5106
5108
  * @param category Данные о категории.
5109
+ * @param clientId Идентификатор клиента.
5107
5110
  * @param newTemplate Параметры конфигуратора для поиска товара.
5108
5111
  * @param validationFieldResultData Список полей, для которых необходимо
5109
5112
  * установить данные об ошибках валидации
@@ -5112,29 +5115,30 @@ class ts extends h {
5112
5115
  * @see /doc/api/internal#/Каталог/api_internal_catalog_categories_configurator_template_create
5113
5116
  */
5114
5117
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
5115
- createTemplate(r, e, s = {}) {
5116
- var i;
5118
+ createTemplate(r, e, s, i = {}) {
5119
+ var o;
5117
5120
  return this.post(
5118
- `internal/catalog/categories/${r.id}/configurators/${(i = r.properties) == null ? void 0 : i.configurator}/template`,
5119
- { ...e },
5121
+ `internal/catalog/categories/${r.id}/configurators/${(o = r.properties) == null ? void 0 : o.configurator}/template?client_id=${e}`,
5122
+ { ...s },
5120
5123
  // eslint-disable-next-line lodash/prefer-noop, @typescript-eslint/no-empty-function
5121
5124
  () => {
5122
5125
  },
5123
- s
5126
+ i
5124
5127
  );
5125
5128
  }
5126
5129
  /**
5127
5130
  * Удаляет пользовательский шаблон конфигуратора.
5128
5131
  *
5129
5132
  * @param category Данные о категории.
5133
+ * @param clientId Идентификатор клиента.
5130
5134
  * @param templateId Идентификатор записи шаблона.
5131
5135
  *
5132
5136
  * @see /doc/api/internal#/Каталог/api_internal_catalog_categories_configurator_template_delete
5133
5137
  */
5134
5138
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
5135
- removeTemplate(r, e) {
5136
- var s;
5137
- return this.delete(`internal/catalog/categories/${r.id}/configurators/${(s = r.properties) == null ? void 0 : s.configurator}/template/${e}`);
5139
+ removeTemplate(r, e, s) {
5140
+ var i;
5141
+ return this.delete(`internal/catalog/categories/${r.id}/configurators/${(i = r.properties) == null ? void 0 : i.configurator}/template/${s}?client_id=${e}`);
5138
5142
  }
5139
5143
  }
5140
5144
  class ss {
@@ -5634,8 +5638,8 @@ class cs extends h {
5634
5638
  const e = T.getConfig().dateFormats.api, s = nr(
5635
5639
  Ne(r, {
5636
5640
  costDate: {
5637
- from: ke((i = r.costDate) == null ? void 0 : i.from) ? d(r.costDate.from, e) : (o = r.costDate) == null ? void 0 : o.from,
5638
- to: ke((c = r.costDate) == null ? void 0 : c.to) ? d(r.costDate.to, e) : (u = r.costDate) == null ? void 0 : u.to
5641
+ from: ke((i = r.costDate) == null ? void 0 : i.from) ? O(r.costDate.from, e) : (o = r.costDate) == null ? void 0 : o.from,
5642
+ to: ke((c = r.costDate) == null ? void 0 : c.to) ? O(r.costDate.to, e) : (u = r.costDate) == null ? void 0 : u.to
5639
5643
  }
5640
5644
  }),
5641
5645
  (p) => A(p) || (Q(p) || or(p)) && Y(p)
@@ -5854,7 +5858,7 @@ class $ extends pe {
5854
5858
  }
5855
5859
  }
5856
5860
  const D = te("__references_private", () => {
5857
- const n = y({}), r = y(void 0), e = y(void 0), s = y(void 0), i = y(void 0), o = y(void 0), c = y(void 0), u = y(void 0), p = y(void 0), f = y(void 0), m = y(void 0), S = y(void 0), _ = y(void 0), O = y(void 0), G = y(void 0), H = y(void 0), $e = y(void 0), l = y(void 0);
5861
+ const n = y({}), r = y(void 0), e = y(void 0), s = y(void 0), i = y(void 0), o = y(void 0), c = y(void 0), u = y(void 0), p = y(void 0), f = y(void 0), m = y(void 0), S = y(void 0), _ = y(void 0), d = y(void 0), G = y(void 0), H = y(void 0), $e = y(void 0), l = y(void 0);
5858
5862
  return {
5859
5863
  /**
5860
5864
  * Список загружаемых/загруженных на данный момент значений.
@@ -5911,7 +5915,7 @@ const D = te("__references_private", () => {
5911
5915
  /**
5912
5916
  * Справочник направлений продаж.
5913
5917
  */
5914
- salesDirectionsReference: O,
5918
+ salesDirectionsReference: d,
5915
5919
  /**
5916
5920
  * Справочник источников первичного интереса.
5917
5921
  */
@@ -5995,7 +5999,7 @@ const D = te("__references_private", () => {
5995
5999
  return !l.deliveryTypeReference && !l.dataLoaderList.deliveryTypeReference && (l.dataLoaderList.deliveryTypeReference = !0, h.getInstance($).getDeliveryTypes().then((g) => {
5996
6000
  l.deliveryTypeReference = g;
5997
6001
  }).catch(w)), l.deliveryTypeReference;
5998
- }), O = R(() => {
6002
+ }), d = R(() => {
5999
6003
  const l = D();
6000
6004
  return !l.managersList && !l.dataLoaderList.managersList && (l.dataLoaderList.managersList = !0, h.getInstance(Pt).getManagers().then((g) => {
6001
6005
  l.managersList = g;
@@ -6072,7 +6076,7 @@ const D = te("__references_private", () => {
6072
6076
  /**
6073
6077
  * Список менеджеров.
6074
6078
  */
6075
- managersList: O,
6079
+ managersList: d,
6076
6080
  /**
6077
6081
  * Справочник складов.
6078
6082
  */
@@ -6323,7 +6327,7 @@ export {
6323
6327
  lt as AnyReference,
6324
6328
  jt as AppBaseConfig,
6325
6329
  T as AppConfigProvider,
6326
- de as BankAccount,
6330
+ Oe as BankAccount,
6327
6331
  Te as BasePaginationProvider,
6328
6332
  Qr as CalculationTypeEnum,
6329
6333
  fe as Cart,
@@ -6423,7 +6427,7 @@ export {
6423
6427
  Vt as PriceTemplateProvider,
6424
6428
  ne as PricingRole,
6425
6429
  Kt as PricingRoleProvider,
6426
- Oe as PrimaryCatalogableItem,
6430
+ de as PrimaryCatalogableItem,
6427
6431
  I as Product,
6428
6432
  Et as ProductCategoryDataProvider,
6429
6433
  zt as ProductDataProvider,