@snabcentr/common-lib 2.7.4 → 2.7.7
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.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +1 -1
- package/dist/sc-common-lib.js +95 -71
- package/dist/sc-common-lib.js.map +1 -1
- package/dist/sc-common-lib.umd.cjs +1 -1
- package/dist/sc-common-lib.umd.cjs.map +1 -1
- package/dist/src/clients/classes/clients-list-filters.d.ts +4 -0
- package/dist/src/clients/classes/clients-list-filters.d.ts.map +1 -1
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts +5 -0
- package/dist/src/clients/interfaces/i-clients-list-filters.d.ts.map +1 -1
- package/dist/src/orders/providers/orders-data-provider.d.ts +16 -0
- package/dist/src/orders/providers/orders-data-provider.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/manifest.json
CHANGED
package/dist/release_notes.tmp
CHANGED
package/dist/sc-common-lib.js
CHANGED
|
@@ -5,10 +5,10 @@ import { jwtDecode as nr } from "jwt-decode";
|
|
|
5
5
|
import { merge as pe, isNil as A, isEmpty as X, noop as v, mapValues as or, isArray as H, every as xr, split as Or, isString as C, constant as qr, toUpper as Nr, cloneDeep as Ur, toLower as Fr, isFunction as Fe, map as fe, forEach as Hr, isDate as xe, omitBy as cr, isObject as lr } from "lodash-es";
|
|
6
6
|
import { objectToCamel as He, objectToSnake as Ee } from "ts-case-convert";
|
|
7
7
|
import { defineStore as W } from "pinia";
|
|
8
|
-
import { ref as y, markRaw as
|
|
9
|
-
import { isAfter as Ve, parseISO as R, startOfToday as Oe, format as k, addSeconds as
|
|
8
|
+
import { ref as y, markRaw as Mr, computed as P } from "vue";
|
|
9
|
+
import { isAfter as Ve, parseISO as R, startOfToday as Oe, format as k, addSeconds as jr, addBusinessDays as Gr, endOfTomorrow as Br, startOfTomorrow as zr, endOfYesterday as Wr, startOfYesterday as Jr, endOfToday as Er, endOfDay as Vr, startOfDay as Kr } from "date-fns";
|
|
10
10
|
import Qr, { CanceledError as Yr } from "axios";
|
|
11
|
-
class
|
|
11
|
+
class M {
|
|
12
12
|
/**
|
|
13
13
|
* Инициализирует экземпляр класса {@link JwtPayload}.
|
|
14
14
|
*
|
|
@@ -107,11 +107,11 @@ class j {
|
|
|
107
107
|
* @param jwtToken JWT-ключ доступа.
|
|
108
108
|
*/
|
|
109
109
|
static getJwtPayload(r) {
|
|
110
|
-
const e = nr(r), s = new
|
|
110
|
+
const e = nr(r), s = new M(He(e));
|
|
111
111
|
return s.resourceAccess = e.resource_access, s;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class zt extends
|
|
114
|
+
class zt extends M {
|
|
115
115
|
/**
|
|
116
116
|
* Инициализирует экземпляр класса {@link DetailedJwtPayload}.
|
|
117
117
|
*
|
|
@@ -151,7 +151,7 @@ class zt extends j {
|
|
|
151
151
|
* @param jwtToken JWT-ключ доступа.
|
|
152
152
|
*/
|
|
153
153
|
static getJwtPayload(e) {
|
|
154
|
-
return new
|
|
154
|
+
return new M(He(nr(e)));
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
class Xr {
|
|
@@ -336,7 +336,7 @@ class tt {
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
const
|
|
339
|
+
const I = W("common.config", () => {
|
|
340
340
|
const i = y(new tt());
|
|
341
341
|
return {
|
|
342
342
|
/**
|
|
@@ -470,7 +470,7 @@ class ve {
|
|
|
470
470
|
}
|
|
471
471
|
function Ke(i) {
|
|
472
472
|
try {
|
|
473
|
-
const r =
|
|
473
|
+
const r = M.getJwtPayload(i);
|
|
474
474
|
return new Date(r.exp * 1e3);
|
|
475
475
|
} catch {
|
|
476
476
|
return;
|
|
@@ -486,13 +486,13 @@ const V = W("common.auth_state_private", () => {
|
|
|
486
486
|
);
|
|
487
487
|
if (o)
|
|
488
488
|
return Promise.resolve(o);
|
|
489
|
-
const c = (u =
|
|
489
|
+
const c = (u = I().config.devMode) == null ? void 0 : u.initAuthBearerToken;
|
|
490
490
|
return c ? Promise.resolve(c) : void 0;
|
|
491
491
|
})()
|
|
492
|
-
), r = y(void 0), e = y(void 0), s =
|
|
492
|
+
), r = y(void 0), e = y(void 0), s = Mr(/* @__PURE__ */ new Map());
|
|
493
493
|
function n() {
|
|
494
494
|
e.value = void 0, A(i.value) || i.value.then((o) => {
|
|
495
|
-
const c =
|
|
495
|
+
const c = M.getJwtPayload(o);
|
|
496
496
|
e.value = c.exp * 1e3 > Date.now() ? or(c.resourceAccess, (u) => (u == null ? void 0 : u.roles) ?? []) : void 0;
|
|
497
497
|
}).catch(v);
|
|
498
498
|
}
|
|
@@ -543,7 +543,7 @@ const V = W("common.auth_state_private", () => {
|
|
|
543
543
|
function n(o) {
|
|
544
544
|
const c = V();
|
|
545
545
|
!A(c.jwtToken) && A(c.userPermissions) && c.jwtToken.then((m) => {
|
|
546
|
-
const f =
|
|
546
|
+
const f = M.getJwtPayload(m);
|
|
547
547
|
c.userPermissions = f.exp * 1e3 > Date.now() ? or(f.resourceAccess, (D) => (D == null ? void 0 : D.roles) ?? []) : void 0;
|
|
548
548
|
}).catch(v);
|
|
549
549
|
const u = H(o) ? o.join(" && ") : o;
|
|
@@ -767,7 +767,7 @@ class qe extends hr {
|
|
|
767
767
|
this.isPrimary = (e == null ? void 0 : e.isPrimary) ?? !1;
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
|
-
class
|
|
770
|
+
class Me {
|
|
771
771
|
/**
|
|
772
772
|
* Инициализирует экземпляр указанного класса.
|
|
773
773
|
*
|
|
@@ -868,7 +868,7 @@ class Re extends w {
|
|
|
868
868
|
return { id: -2, slug: gr.Retail, name: "Розн. цена", guid: "", isNewRec: qr(!0) };
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
class
|
|
871
|
+
class je {
|
|
872
872
|
/**
|
|
873
873
|
* Инициализирует экземпляр класса {@link ProductPriceCoefficient}.
|
|
874
874
|
*
|
|
@@ -1101,7 +1101,7 @@ class L extends it {
|
|
|
1101
1101
|
t(this, "priceCoefficients");
|
|
1102
1102
|
this.supplierSku = e == null ? void 0 : e.supplierSku, this.unit = e != null && e.unit ? new Qe(e.unit) : new Qe(), this.pack = e == null ? void 0 : e.pack, this.minCount = e == null ? void 0 : e.minCount, this.currency = e != null && e.currency ? new O(e.currency) : new O(), 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) ? R(e.costDate) : e == null ? void 0 : e.costDate, this.onOrder = (e == null ? void 0 : e.onOrder) ?? !1, this.stockCount = ((n = e == null ? void 0 : e.stockCount) == null ? void 0 : n.map((h) => new ot(h))) ?? [], this.type = "product";
|
|
1103
1103
|
const s = (e == null ? void 0 : e.category) ?? ((o = e == null ? void 0 : e.categories) == null ? void 0 : o.find((h) => h.isPrimary));
|
|
1104
|
-
s && (this.category = new qe({ ...s, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((h) => new qe(h))), this.images = ((c = e == null ? void 0 : e.images) == null ? void 0 : c.map((h) => new st(h,
|
|
1104
|
+
s && (this.category = new qe({ ...s, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((h) => new qe(h))), this.images = ((c = e == null ? void 0 : e.images) == null ? void 0 : c.map((h) => new st(h, I().config.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((h) => new je(h))) ?? [], e && "codeNumber" in e && !e.code && (this.code = e == null ? void 0 : e.codeNumber);
|
|
1105
1105
|
}
|
|
1106
1106
|
/**
|
|
1107
1107
|
* Возвращает признак, что это измеряемый товар.
|
|
@@ -1122,8 +1122,8 @@ class L extends it {
|
|
|
1122
1122
|
return this.retailCostRub ?? this.costRub;
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
|
-
var
|
|
1126
|
-
class
|
|
1125
|
+
var Ge = /* @__PURE__ */ ((i) => (i.Discount = "discount", i.PriceTemplate = "price_template", i.ClientPrice = "client_price", i.Product = "product", i))(Ge || {});
|
|
1126
|
+
class j extends L {
|
|
1127
1127
|
/**
|
|
1128
1128
|
* Инициализирует экземпляр класса {@link ClientProduct}.
|
|
1129
1129
|
*
|
|
@@ -1159,7 +1159,7 @@ class G extends L {
|
|
|
1159
1159
|
* Признак того, что указанный продукт входит в список избранных продуктов клиента.
|
|
1160
1160
|
*/
|
|
1161
1161
|
t(this, "isFavorite");
|
|
1162
|
-
this.costCoefficient = (e == null ? void 0 : e.costCoefficient) ?? 0, this.costSource = (e == null ? void 0 : e.costSource) ??
|
|
1162
|
+
this.costCoefficient = (e == null ? void 0 : e.costCoefficient) ?? 0, this.costSource = (e == null ? void 0 : e.costSource) ?? Ge.Product, this.discount = e != null && e.discount ? new nt(e.discount) : void 0, this.priceTemplate = e != null && e.priceTemplate ? new Q(e.priceTemplate) : void 0, this.isPreviouslyOrdered = e == null ? void 0 : e.isPreviouslyOrdered, this.isRequired = e == null ? void 0 : e.isRequired, this.isFavorite = e == null ? void 0 : e.isFavorite;
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
1165
|
class we extends qe {
|
|
@@ -1265,7 +1265,7 @@ class fr extends re {
|
|
|
1265
1265
|
* @inheritDoc
|
|
1266
1266
|
*/
|
|
1267
1267
|
t(this, "replacementId");
|
|
1268
|
-
this.product = new
|
|
1268
|
+
this.product = new j(e.product), this.quantity = e.quantity ?? 0, this.marker = e.marker, this.category = e.category ?? new we(), this.currency = e.currency ? new O(e.currency) : void 0, this.height = e.height, this.length = e.length, this.width = e.width, this.configurator = e.configurator, this.configuratorParams = e.configuratorParams && Ur(e.configuratorParams), this.isAdditionalSale = e.isAdditionalSale, this.creator = e.creator && new _(e.creator), this.isRemoved = e.isRemoved, this.ord = e.ord, this.onOrder = e.onOrder, this.originalId = e.originalId, this.replacementId = e.replacementId;
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
let ct = class extends fr {
|
|
@@ -1349,7 +1349,7 @@ const a = class a {
|
|
|
1349
1349
|
/**
|
|
1350
1350
|
* Базовый URL путь для выполнения запросов.
|
|
1351
1351
|
*/
|
|
1352
|
-
t(this, "baseUrl", `${
|
|
1352
|
+
t(this, "baseUrl", `${I().config.http.portalApiUrl}/api`);
|
|
1353
1353
|
/**
|
|
1354
1354
|
* Обработчик ошибок выполнения запросов текущего экземпляра класса.
|
|
1355
1355
|
*
|
|
@@ -1492,7 +1492,7 @@ const a = class a {
|
|
|
1492
1492
|
* @param type Тип данных, которыми оперирует метод.
|
|
1493
1493
|
*/
|
|
1494
1494
|
static getInstance(r) {
|
|
1495
|
-
return Object.prototype.hasOwnProperty.call(a.instances, r.name) || (a.instances[r.name] =
|
|
1495
|
+
return Object.prototype.hasOwnProperty.call(a.instances, r.name) || (a.instances[r.name] = Me.simpleInstanceInitializer(r)), a.instances[r.name];
|
|
1496
1496
|
}
|
|
1497
1497
|
/**
|
|
1498
1498
|
* Конвертирует данные ошибки HTTP запроса в более упрощённую и часто используемую форму.
|
|
@@ -1905,7 +1905,7 @@ class ae extends ht {
|
|
|
1905
1905
|
* Список продуктов категории.
|
|
1906
1906
|
*/
|
|
1907
1907
|
t(this, "products");
|
|
1908
|
-
this.categories = (s = e == null ? void 0 : e.categories) == null ? void 0 : s.map((o) => new ae(o)), this.products = (n = e == null ? void 0 : e.products) == null ? void 0 : n.map((o) => new
|
|
1908
|
+
this.categories = (s = e == null ? void 0 : e.categories) == null ? void 0 : s.map((o) => new ae(o)), this.products = (n = e == null ? void 0 : e.products) == null ? void 0 : n.map((o) => new j(o));
|
|
1909
1909
|
}
|
|
1910
1910
|
}
|
|
1911
1911
|
class wr {
|
|
@@ -2336,7 +2336,7 @@ class Vt extends p {
|
|
|
2336
2336
|
*/
|
|
2337
2337
|
// eslint-disable-next-line class-methods-use-this
|
|
2338
2338
|
getPriceExportLink(r = "csv", e = !1, s = void 0, n = void 0) {
|
|
2339
|
-
let c = `${
|
|
2339
|
+
let c = `${I().config.http.portalApiUrl}/api/internal/price/export?format=${r}&show_hidden=${e}`;
|
|
2340
2340
|
return s && (c += `&category_id=${s}`), n && (c += `&client_id=${n}`), c;
|
|
2341
2341
|
}
|
|
2342
2342
|
}
|
|
@@ -2464,7 +2464,7 @@ class Kt extends p {
|
|
|
2464
2464
|
price_coefficient_id: (n = s.coefficient) == null ? void 0 : n.id,
|
|
2465
2465
|
increase_percent: s.value
|
|
2466
2466
|
},
|
|
2467
|
-
(o) => new
|
|
2467
|
+
(o) => new j(o.data)
|
|
2468
2468
|
);
|
|
2469
2469
|
}
|
|
2470
2470
|
/**
|
|
@@ -2476,7 +2476,7 @@ class Kt extends p {
|
|
|
2476
2476
|
* @see /doc/api/internal#/operations/api_internal_client_price_products_remove
|
|
2477
2477
|
*/
|
|
2478
2478
|
removeProductPrice(r, e) {
|
|
2479
|
-
return this.delete(`/internal/clients/${r}/price/products/${e}`, (s) => new
|
|
2479
|
+
return this.delete(`/internal/clients/${r}/price/products/${e}`, (s) => new j(s.data));
|
|
2480
2480
|
}
|
|
2481
2481
|
/**
|
|
2482
2482
|
* Добавляет указанный продукт в список товаров для дополнительных продаж.
|
|
@@ -2574,7 +2574,7 @@ class Qt extends p {
|
|
|
2574
2574
|
* @see /doc/api/internal#/operations/api_internal_client_price_template_attach
|
|
2575
2575
|
*/
|
|
2576
2576
|
attachTemplate(r, e, s) {
|
|
2577
|
-
const n =
|
|
2577
|
+
const n = I().config.dateFormats.api;
|
|
2578
2578
|
return this.post(
|
|
2579
2579
|
`/internal/clients/${r}/price/templates/${e}`,
|
|
2580
2580
|
s && {
|
|
@@ -2608,7 +2608,7 @@ class Qt extends p {
|
|
|
2608
2608
|
* @see /doc/api/internal#/operations/api_internal_client_price_template_change
|
|
2609
2609
|
*/
|
|
2610
2610
|
changeTemplate(r, e, s, n) {
|
|
2611
|
-
const o =
|
|
2611
|
+
const o = I().config.dateFormats.api;
|
|
2612
2612
|
return this.patch(
|
|
2613
2613
|
`/internal/clients/${r}/price/templates/${e}/${s}`,
|
|
2614
2614
|
n && {
|
|
@@ -2704,7 +2704,7 @@ class Yt extends p {
|
|
|
2704
2704
|
getCategoryProductsCoefficients(r) {
|
|
2705
2705
|
return this.get(`/internal/catalog/categories/${r}/products/coefficients`, {}, (e) => {
|
|
2706
2706
|
const { data: s } = e;
|
|
2707
|
-
return Hr(s, (n) => n.map((o) => new
|
|
2707
|
+
return Hr(s, (n) => n.map((o) => new je(o))), s;
|
|
2708
2708
|
});
|
|
2709
2709
|
}
|
|
2710
2710
|
/**
|
|
@@ -2754,7 +2754,7 @@ class Xt extends p {
|
|
|
2754
2754
|
return this.get(
|
|
2755
2755
|
`/internal/catalog/products/${r}/coefficients`,
|
|
2756
2756
|
{},
|
|
2757
|
-
(e) => fe(e.data, (s) => new
|
|
2757
|
+
(e) => fe(e.data, (s) => new je(s))
|
|
2758
2758
|
);
|
|
2759
2759
|
}
|
|
2760
2760
|
/**
|
|
@@ -2831,7 +2831,7 @@ class Zt extends p {
|
|
|
2831
2831
|
showHidden: n,
|
|
2832
2832
|
withPriceCoefficients: s
|
|
2833
2833
|
},
|
|
2834
|
-
(o) => fe(o.data, (c) => new
|
|
2834
|
+
(o) => fe(o.data, (c) => new j(c))
|
|
2835
2835
|
);
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
@@ -2852,7 +2852,7 @@ class es extends p {
|
|
|
2852
2852
|
clientId: e,
|
|
2853
2853
|
withPriceCoefficients: s
|
|
2854
2854
|
},
|
|
2855
|
-
(n) => new
|
|
2855
|
+
(n) => new j(n.data)
|
|
2856
2856
|
);
|
|
2857
2857
|
}
|
|
2858
2858
|
}
|
|
@@ -2888,10 +2888,10 @@ class Xe {
|
|
|
2888
2888
|
field: this.field,
|
|
2889
2889
|
op: this.op
|
|
2890
2890
|
};
|
|
2891
|
-
return r.value = xe(this.value) ? k(this.value,
|
|
2891
|
+
return r.value = xe(this.value) ? k(this.value, I().config.dateFormats.api) : this.value, r;
|
|
2892
2892
|
}
|
|
2893
2893
|
}
|
|
2894
|
-
class
|
|
2894
|
+
class G {
|
|
2895
2895
|
/**
|
|
2896
2896
|
* Инициализирует экземпляр класса {@link FilterGroup}.
|
|
2897
2897
|
*
|
|
@@ -2911,7 +2911,7 @@ class M {
|
|
|
2911
2911
|
*/
|
|
2912
2912
|
t(this, "groups");
|
|
2913
2913
|
var e, s;
|
|
2914
|
-
this.groupOp = (r == null ? void 0 : r.groupOp) ?? "and", this.filters = ((e = r == null ? void 0 : r.filters) == null ? void 0 : e.map((n) => new Xe(n))) ?? [], this.groups = ((s = r == null ? void 0 : r.groups) == null ? void 0 : s.map((n) => new
|
|
2914
|
+
this.groupOp = (r == null ? void 0 : r.groupOp) ?? "and", this.filters = ((e = r == null ? void 0 : r.filters) == null ? void 0 : e.map((n) => new Xe(n))) ?? [], this.groups = ((s = r == null ? void 0 : r.groups) == null ? void 0 : s.map((n) => new G(n))) ?? [];
|
|
2915
2915
|
}
|
|
2916
2916
|
/**
|
|
2917
2917
|
* Преобразует группу фильтров в примитивное представление для API.
|
|
@@ -2922,7 +2922,7 @@ class M {
|
|
|
2922
2922
|
return {
|
|
2923
2923
|
groupOp: this.groupOp,
|
|
2924
2924
|
filters: this.filters.map((r) => r instanceof Xe && Fe(r.toPrimitive) ? r.toPrimitive() : r),
|
|
2925
|
-
groups: this.groups.map((r) => r instanceof
|
|
2925
|
+
groups: this.groups.map((r) => r instanceof G ? r.toPrimitive() : r)
|
|
2926
2926
|
};
|
|
2927
2927
|
}
|
|
2928
2928
|
}
|
|
@@ -2944,7 +2944,7 @@ class Ae extends p {
|
|
|
2944
2944
|
page: (n == null ? void 0 : n.page) ?? 1,
|
|
2945
2945
|
perPage: (n == null ? void 0 : n.pageSize) ?? 10
|
|
2946
2946
|
};
|
|
2947
|
-
return e && (m.filters = JSON.stringify((e instanceof
|
|
2947
|
+
return e && (m.filters = JSON.stringify((e instanceof G ? e : new G(e)).toPrimitive())), X(s) || (m.sort = H(s) ? s : [s]), o && (m = { ...m, ...o }), this.get(r, m, c, u, h);
|
|
2948
2948
|
}
|
|
2949
2949
|
}
|
|
2950
2950
|
class rs extends Ae {
|
|
@@ -4223,6 +4223,10 @@ class cs extends Sr {
|
|
|
4223
4223
|
* @inheritDoc
|
|
4224
4224
|
*/
|
|
4225
4225
|
t(this, "managers");
|
|
4226
|
+
/**
|
|
4227
|
+
* @inheritDoc
|
|
4228
|
+
*/
|
|
4229
|
+
t(this, "includeSubordinateManagers");
|
|
4226
4230
|
/**
|
|
4227
4231
|
* @inheritDoc
|
|
4228
4232
|
*/
|
|
@@ -4259,7 +4263,7 @@ class cs extends Sr {
|
|
|
4259
4263
|
* @inheritDoc
|
|
4260
4264
|
*/
|
|
4261
4265
|
t(this, "lastOrder");
|
|
4262
|
-
this.id = e == null ? void 0 : e.id, this.name = e == null ? void 0 : e.name, this.alternativeName = e == null ? void 0 : e.alternativeName, this.searchTerm = e == null ? void 0 : e.searchTerm, this.cities = (s = e == null ? void 0 : e.cities) == null ? void 0 : s.map((D) => new De(D)), this.region = new ge(e == null ? void 0 : e.region), this.country = new Z(e == null ? void 0 : e.country), this.phone = e == null ? void 0 : e.phone, this.email = e == null ? void 0 : e.email, this.isActive = e && Object.prototype.hasOwnProperty.call(e, "isActive") ? e == null ? void 0 : e.isActive : !0, this.createdAt = new b(e == null ? void 0 : e.createdAt), this.lastLoginDate = new b(e == null ? void 0 : e.lastLoginDate), this.lastLoginDateHasOrder = (e == null ? void 0 : e.lastLoginDateHasOrder) ?? void 0, this.managers = ((n = e == null ? void 0 : e.managers) == null ? void 0 : n.map((D) => new Pe(D))) ?? [], this.curators = ((o = e == null ? void 0 : e.curators) == null ? void 0 : o.map((D) => new We(D))) ?? [], this.salesDirections = (c = e == null ? void 0 : e.salesDirections) == null ? void 0 : c.map((D) => new q(D)), this.contragentInn = e == null ? void 0 : e.contragentInn, this.contragentType = new B(e == null ? void 0 : e.contragentType), this.preferredDeliveryType = e != null && e.preferredDeliveryType ? new F(e == null ? void 0 : e.preferredDeliveryType) : void 0, this.partnerGroups = (u = e == null ? void 0 : e.partnerGroups) == null ? void 0 : u.map((D) => new ee(D)), this.contact = new Ue(e == null ? void 0 : e.contact), this.lastOrder = {
|
|
4266
|
+
this.id = e == null ? void 0 : e.id, this.name = e == null ? void 0 : e.name, this.alternativeName = e == null ? void 0 : e.alternativeName, this.searchTerm = e == null ? void 0 : e.searchTerm, this.cities = (s = e == null ? void 0 : e.cities) == null ? void 0 : s.map((D) => new De(D)), this.region = new ge(e == null ? void 0 : e.region), this.country = new Z(e == null ? void 0 : e.country), this.phone = e == null ? void 0 : e.phone, this.email = e == null ? void 0 : e.email, this.isActive = e && Object.prototype.hasOwnProperty.call(e, "isActive") ? e == null ? void 0 : e.isActive : !0, this.createdAt = new b(e == null ? void 0 : e.createdAt), this.lastLoginDate = new b(e == null ? void 0 : e.lastLoginDate), this.lastLoginDateHasOrder = (e == null ? void 0 : e.lastLoginDateHasOrder) ?? void 0, this.managers = ((n = e == null ? void 0 : e.managers) == null ? void 0 : n.map((D) => new Pe(D))) ?? [], this.includeSubordinateManagers = (e == null ? void 0 : e.includeSubordinateManagers) ?? !0, this.curators = ((o = e == null ? void 0 : e.curators) == null ? void 0 : o.map((D) => new We(D))) ?? [], this.salesDirections = (c = e == null ? void 0 : e.salesDirections) == null ? void 0 : c.map((D) => new q(D)), this.contragentInn = e == null ? void 0 : e.contragentInn, this.contragentType = new B(e == null ? void 0 : e.contragentType), this.preferredDeliveryType = e != null && e.preferredDeliveryType ? new F(e == null ? void 0 : e.preferredDeliveryType) : void 0, this.partnerGroups = (u = e == null ? void 0 : e.partnerGroups) == null ? void 0 : u.map((D) => new ee(D)), this.contact = new Ue(e == null ? void 0 : e.contact), this.lastOrder = {
|
|
4263
4267
|
createdAt: new b((h = e == null ? void 0 : e.lastOrder) == null ? void 0 : h.createdAt),
|
|
4264
4268
|
creator: (m = e == null ? void 0 : e.lastOrder) == null ? void 0 : m.creator,
|
|
4265
4269
|
isApproved: (f = e == null ? void 0 : e.lastOrder) == null ? void 0 : f.isApproved
|
|
@@ -5161,7 +5165,7 @@ const Y = class Y extends p {
|
|
|
5161
5165
|
* Время кэширования данных ответов на запросы (секунд).
|
|
5162
5166
|
*/
|
|
5163
5167
|
t(this, "responseDataCacheTimeout");
|
|
5164
|
-
this.responseDataCacheTimeout =
|
|
5168
|
+
this.responseDataCacheTimeout = I().config.http.responseDataCacheTimeout;
|
|
5165
5169
|
}
|
|
5166
5170
|
/**
|
|
5167
5171
|
* Возвращает кэшированные данные.
|
|
@@ -5183,7 +5187,7 @@ const Y = class Y extends p {
|
|
|
5183
5187
|
*/
|
|
5184
5188
|
cacheResponse(e, s) {
|
|
5185
5189
|
Y.responseDataCache.set(e, {
|
|
5186
|
-
validTo:
|
|
5190
|
+
validTo: jr(/* @__PURE__ */ new Date(), this.responseDataCacheTimeout),
|
|
5187
5191
|
val: s
|
|
5188
5192
|
});
|
|
5189
5193
|
}
|
|
@@ -5200,7 +5204,7 @@ const Y = class Y extends p {
|
|
|
5200
5204
|
getTypedDataArrayRequester(e, s, n = !1, o = {}) {
|
|
5201
5205
|
const c = s + (X(o) ? "" : ` >>> ${JSON.stringify(o)}`), u = n ? Y.getCachedResponse(c) : void 0;
|
|
5202
5206
|
return u ? Promise.resolve(u) : this.get(s, o).then((h) => {
|
|
5203
|
-
const m = h.map((f) =>
|
|
5207
|
+
const m = h.map((f) => Me.instanceInitializer(e, f));
|
|
5204
5208
|
return n && m && this.cacheResponse(s, m), m;
|
|
5205
5209
|
});
|
|
5206
5210
|
}
|
|
@@ -5343,7 +5347,7 @@ class ms {
|
|
|
5343
5347
|
* Возвращает диапазон дат по умолчанию.
|
|
5344
5348
|
*/
|
|
5345
5349
|
static defaultDateRanges() {
|
|
5346
|
-
const r =
|
|
5350
|
+
const r = Gr(/* @__PURE__ */ new Date(), 1);
|
|
5347
5351
|
return {
|
|
5348
5352
|
// 'Следующий рабочий день' - это значение по-умолчанию
|
|
5349
5353
|
nextWorkingDay: { label: "Следующий рабочий день", from: Kr(r), to: Vr(r) },
|
|
@@ -5409,7 +5413,7 @@ class At extends me {
|
|
|
5409
5413
|
const r = "/internal/managers", e = me.getCachedResponse(r);
|
|
5410
5414
|
if (e)
|
|
5411
5415
|
return e;
|
|
5412
|
-
const n = (await this.get(r)).data.map((o) =>
|
|
5416
|
+
const n = (await this.get(r)).data.map((o) => Me.instanceInitializer(Pe, o));
|
|
5413
5417
|
return this.cacheResponse(r, n), n;
|
|
5414
5418
|
}
|
|
5415
5419
|
}
|
|
@@ -6151,10 +6155,10 @@ class St extends fr {
|
|
|
6151
6155
|
* Продукт, которым заменена текущая запись.
|
|
6152
6156
|
*/
|
|
6153
6157
|
t(this, "replacement");
|
|
6154
|
-
this.product = new
|
|
6158
|
+
this.product = new j(e.product), this.currency = new O(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, s && (this.replacement = s, this.quantity !== s.quantity && this.changedFields.push("quantity"), this.length !== s.length && this.changedFields.push("length"));
|
|
6155
6159
|
}
|
|
6156
6160
|
}
|
|
6157
|
-
class
|
|
6161
|
+
class d extends kr {
|
|
6158
6162
|
/**
|
|
6159
6163
|
* Инициализирует экземпляр класса {@link Order}.
|
|
6160
6164
|
*
|
|
@@ -6285,7 +6289,7 @@ class Cs extends Ae {
|
|
|
6285
6289
|
getOrdersCount(r, e = void 0) {
|
|
6286
6290
|
return this.get(
|
|
6287
6291
|
"/internal/orders/count",
|
|
6288
|
-
r ? { filters: JSON.stringify((r instanceof
|
|
6292
|
+
r ? { filters: JSON.stringify((r instanceof G ? r : new G(r)).toPrimitive()) } : {},
|
|
6289
6293
|
void 0,
|
|
6290
6294
|
void 0,
|
|
6291
6295
|
e
|
|
@@ -6308,7 +6312,7 @@ class Cs extends Ae {
|
|
|
6308
6312
|
* @see /doc/api/internal#/Заказы/api_internal_orders_get
|
|
6309
6313
|
*/
|
|
6310
6314
|
getOrder(r) {
|
|
6311
|
-
return this.get(`/internal/orders/${r}`, {}, (e) => new
|
|
6315
|
+
return this.get(`/internal/orders/${r}`, {}, (e) => new d(e.data));
|
|
6312
6316
|
}
|
|
6313
6317
|
/**
|
|
6314
6318
|
* Создаёт новый заказ клиента из содержимого корзины текущего пользователя.
|
|
@@ -6322,14 +6326,14 @@ class Cs extends Ae {
|
|
|
6322
6326
|
* @see /doc/api/internal#/operations/api_internal_client_orders_create
|
|
6323
6327
|
*/
|
|
6324
6328
|
createClientOrder(r, e, s, n = {}) {
|
|
6325
|
-
const o =
|
|
6329
|
+
const o = I().config.dateFormats.api;
|
|
6326
6330
|
return this.post(
|
|
6327
6331
|
`/internal/clients/${r}/orders/${e}`,
|
|
6328
6332
|
{
|
|
6329
6333
|
...s,
|
|
6330
6334
|
deliveryDate: k(s.deliveryDate, o)
|
|
6331
6335
|
},
|
|
6332
|
-
(c) => c.data.map((u) => new
|
|
6336
|
+
(c) => c.data.map((u) => new d(u)),
|
|
6333
6337
|
n
|
|
6334
6338
|
);
|
|
6335
6339
|
}
|
|
@@ -6341,7 +6345,7 @@ class Cs extends Ae {
|
|
|
6341
6345
|
* @see /doc/api/internal#/Заказы/api_internal_orders_attach
|
|
6342
6346
|
*/
|
|
6343
6347
|
attachOrder(r) {
|
|
6344
|
-
return this.patch(`/internal/orders/${r}/attach`, {}, (e) => new
|
|
6348
|
+
return this.patch(`/internal/orders/${r}/attach`, {}, (e) => new d(e.data));
|
|
6345
6349
|
}
|
|
6346
6350
|
/**
|
|
6347
6351
|
* Открепляет указанный заказ от оператора и возвращает полные данные заказа.
|
|
@@ -6351,7 +6355,27 @@ class Cs extends Ae {
|
|
|
6351
6355
|
* @see /doc/api/internal#/Заказы/api_internal_orders_detach
|
|
6352
6356
|
*/
|
|
6353
6357
|
detachOrder(r) {
|
|
6354
|
-
return this.patch(`/internal/orders/${r}/detach`, {}, (e) => new
|
|
6358
|
+
return this.patch(`/internal/orders/${r}/detach`, {}, (e) => new d(e.data));
|
|
6359
|
+
}
|
|
6360
|
+
/**
|
|
6361
|
+
* Пересчитывает стоимость корзины указанного заказа и возвращает обновлённые данные заказа.
|
|
6362
|
+
*
|
|
6363
|
+
* @param orderId Идентификатор заказа.
|
|
6364
|
+
*
|
|
6365
|
+
* @see /doc/api/internal#/Заказы/api_internal_orders_recalculate
|
|
6366
|
+
*/
|
|
6367
|
+
recalculateOrder(r) {
|
|
6368
|
+
return this.patch(`/internal/orders/${r}/recalculate`, {}, (e) => new d(e.data));
|
|
6369
|
+
}
|
|
6370
|
+
/**
|
|
6371
|
+
* Копирует товары указанного заказа в текущую корзину пользователя.
|
|
6372
|
+
*
|
|
6373
|
+
* @param orderId Идентификатор заказа-источника.
|
|
6374
|
+
*
|
|
6375
|
+
* @see /doc/api/internal#/Заказы/api_internal_orders_clone
|
|
6376
|
+
*/
|
|
6377
|
+
cloneOrder(r) {
|
|
6378
|
+
return this.get(`/internal/orders/${r}/clone`, {});
|
|
6355
6379
|
}
|
|
6356
6380
|
/**
|
|
6357
6381
|
* Обновляет данные заказа без изменения состава товаров и возвращает обновлённые данные заказа.
|
|
@@ -6365,14 +6389,14 @@ class Cs extends Ae {
|
|
|
6365
6389
|
* @see /doc/api/internal#/Заказы/api_internal_orders_update
|
|
6366
6390
|
*/
|
|
6367
6391
|
updateOrder(r, e, s = {}) {
|
|
6368
|
-
const n =
|
|
6392
|
+
const n = I().config.dateFormats.api;
|
|
6369
6393
|
return this.patch(
|
|
6370
6394
|
`/internal/orders/${r}`,
|
|
6371
6395
|
{
|
|
6372
6396
|
...e,
|
|
6373
6397
|
deliveryDate: e.deliveryDate ? k(e.deliveryDate, n) : void 0
|
|
6374
6398
|
},
|
|
6375
|
-
(o) => new
|
|
6399
|
+
(o) => new d(o.data),
|
|
6376
6400
|
s
|
|
6377
6401
|
);
|
|
6378
6402
|
}
|
|
@@ -6402,7 +6426,7 @@ class Cs extends Ae {
|
|
|
6402
6426
|
is_additional_sale: e.isAdditionalSale,
|
|
6403
6427
|
...e.configuratorParams
|
|
6404
6428
|
},
|
|
6405
|
-
(n) => new
|
|
6429
|
+
(n) => new d(n.data),
|
|
6406
6430
|
s
|
|
6407
6431
|
);
|
|
6408
6432
|
}
|
|
@@ -6425,7 +6449,7 @@ class Cs extends Ae {
|
|
|
6425
6449
|
status: e,
|
|
6426
6450
|
statusDetail: s
|
|
6427
6451
|
},
|
|
6428
|
-
(o) => new
|
|
6452
|
+
(o) => new d(o.data),
|
|
6429
6453
|
n
|
|
6430
6454
|
);
|
|
6431
6455
|
}
|
|
@@ -6439,7 +6463,7 @@ class Cs extends Ae {
|
|
|
6439
6463
|
* @see /doc/api/internal#/Заказы/api_internal_orders_status_change
|
|
6440
6464
|
*/
|
|
6441
6465
|
changeOrderStatusDetail(r, e) {
|
|
6442
|
-
return this.patch(`/internal/orders/${r}/status`, { statusDetail: e }, (s) => new
|
|
6466
|
+
return this.patch(`/internal/orders/${r}/status`, { statusDetail: e }, (s) => new d(s.data));
|
|
6443
6467
|
}
|
|
6444
6468
|
/**
|
|
6445
6469
|
* Возвращает историю изменения статусов заказа.
|
|
@@ -6464,7 +6488,7 @@ class Cs extends Ae {
|
|
|
6464
6488
|
* @see /doc/api/internal#/Заказы/api_internal_orders_change_attached_operator
|
|
6465
6489
|
*/
|
|
6466
6490
|
changeAttachedOperator(r, e) {
|
|
6467
|
-
return this.patch(`/internal/orders/${r}/change-attached-operator`, { operatorId: e }, (s) => new
|
|
6491
|
+
return this.patch(`/internal/orders/${r}/change-attached-operator`, { operatorId: e }, (s) => new d(s.data));
|
|
6468
6492
|
}
|
|
6469
6493
|
/**
|
|
6470
6494
|
* Удаляет файл, прикреплённый к заказу клиентом, и возвращает обновлённые данные заказа.
|
|
@@ -6474,7 +6498,7 @@ class Cs extends Ae {
|
|
|
6474
6498
|
* @see /doc/api/internal#/Заказы/api_internal_orders_attached_file_delete
|
|
6475
6499
|
*/
|
|
6476
6500
|
deleteOrderAttachedFile(r) {
|
|
6477
|
-
return this.delete(`/internal/orders/${r}/file/attached`, (e) => new
|
|
6501
|
+
return this.delete(`/internal/orders/${r}/file/attached`, (e) => new d(e.data));
|
|
6478
6502
|
}
|
|
6479
6503
|
/**
|
|
6480
6504
|
* Удаляет продукт из заказа и возвращает обновлённые данные заказа.
|
|
@@ -6485,7 +6509,7 @@ class Cs extends Ae {
|
|
|
6485
6509
|
* @see /doc/api/internal#/operations/api_internal_orders_product_delete
|
|
6486
6510
|
*/
|
|
6487
6511
|
deleteOrderProduct(r, e) {
|
|
6488
|
-
return this.delete(`/internal/orders/${r}/products/${e}`, (s) => new
|
|
6512
|
+
return this.delete(`/internal/orders/${r}/products/${e}`, (s) => new d(s.data));
|
|
6489
6513
|
}
|
|
6490
6514
|
/**
|
|
6491
6515
|
* Изменяет продукт заказа и возвращает обновлённые данные заказа.
|
|
@@ -6513,7 +6537,7 @@ class Cs extends Ae {
|
|
|
6513
6537
|
marker: s.marker,
|
|
6514
6538
|
...s.configuratorParams
|
|
6515
6539
|
},
|
|
6516
|
-
(o) => new
|
|
6540
|
+
(o) => new d(o.data),
|
|
6517
6541
|
n
|
|
6518
6542
|
);
|
|
6519
6543
|
}
|
|
@@ -6548,7 +6572,7 @@ class Cs extends Ae {
|
|
|
6548
6572
|
* @see /doc/api/internal#/operations/api_internal_orders_delivery_get_cost
|
|
6549
6573
|
*/
|
|
6550
6574
|
getDeliveryCost(r, e, s, n = void 0) {
|
|
6551
|
-
const o =
|
|
6575
|
+
const o = I().config.dateFormats.api;
|
|
6552
6576
|
return this.get(
|
|
6553
6577
|
`/internal/orders/delivery/${r}/cost`,
|
|
6554
6578
|
{
|
|
@@ -6588,7 +6612,7 @@ class Le {
|
|
|
6588
6612
|
* Источник клиентской цены.
|
|
6589
6613
|
*/
|
|
6590
6614
|
t(this, "source");
|
|
6591
|
-
this.client = new te(r == null ? void 0 : r.client), this.product = new L(r == null ? void 0 : r.product), this.cost = (r == null ? void 0 : r.cost) ?? 0, this.costCoefficient = (r == null ? void 0 : r.costCoefficient) ?? 0, this.source = (r == null ? void 0 : r.source) ??
|
|
6615
|
+
this.client = new te(r == null ? void 0 : r.client), this.product = new L(r == null ? void 0 : r.product), this.cost = (r == null ? void 0 : r.cost) ?? 0, this.costCoefficient = (r == null ? void 0 : r.costCoefficient) ?? 0, this.source = (r == null ? void 0 : r.source) ?? Ge.Product;
|
|
6592
6616
|
}
|
|
6593
6617
|
}
|
|
6594
6618
|
const _e = (i) => {
|
|
@@ -6744,7 +6768,7 @@ class Ps extends p {
|
|
|
6744
6768
|
*/
|
|
6745
6769
|
getProductPriceHistory(r) {
|
|
6746
6770
|
var o, c, u, h, m;
|
|
6747
|
-
const e =
|
|
6771
|
+
const e = I().config.dateFormats.api, s = cr(
|
|
6748
6772
|
pe(r, {
|
|
6749
6773
|
costDate: {
|
|
6750
6774
|
from: xe((o = r.costDate) == null ? void 0 : o.from) ? k(r.costDate.from, e) : (c = r.costDate) == null ? void 0 : c.from,
|
|
@@ -6990,7 +7014,7 @@ class Ts extends p {
|
|
|
6990
7014
|
* Инициализирует экземпляр класса {@link UserAuthDataProvider}.
|
|
6991
7015
|
*/
|
|
6992
7016
|
constructor() {
|
|
6993
|
-
super(), this.baseUrl = `${
|
|
7017
|
+
super(), this.baseUrl = `${I().config.http.portalApiUrl}/api`, this.interceptorIds.request.authRequestInterceptor && this.httpClient.interceptors.request.eject(this.interceptorIds.request.authRequestInterceptor);
|
|
6994
7018
|
}
|
|
6995
7019
|
/**
|
|
6996
7020
|
* Функция для получения обновленных токенов доступа.
|
|
@@ -7079,7 +7103,7 @@ export {
|
|
|
7079
7103
|
x as ClientDataProvider,
|
|
7080
7104
|
Kt as ClientPriceProvider,
|
|
7081
7105
|
Qt as ClientPriceTemplateProvider,
|
|
7082
|
-
|
|
7106
|
+
j as ClientProduct,
|
|
7083
7107
|
Zt as ClientProductCategoryDataProvider,
|
|
7084
7108
|
es as ClientProductDataProvider,
|
|
7085
7109
|
te as ClientShortInfo,
|
|
@@ -7100,7 +7124,7 @@ export {
|
|
|
7100
7124
|
vt as ContragentPerson,
|
|
7101
7125
|
at as ContragentUlNr,
|
|
7102
7126
|
br as ContragentUlR,
|
|
7103
|
-
|
|
7127
|
+
Ge as CostSourceEnum,
|
|
7104
7128
|
Z as Country,
|
|
7105
7129
|
ze as CuratedDirection,
|
|
7106
7130
|
We as Curator,
|
|
@@ -7117,7 +7141,7 @@ export {
|
|
|
7117
7141
|
Xr as DeviceTypeResolutionConfig,
|
|
7118
7142
|
nt as DiscountShortInfo,
|
|
7119
7143
|
Ss as FieldValidationResultData,
|
|
7120
|
-
|
|
7144
|
+
G as FilterGroup,
|
|
7121
7145
|
Xe as FilterItem,
|
|
7122
7146
|
Je as FilterOpEnum,
|
|
7123
7147
|
mr as GeoCoordinates,
|
|
@@ -7127,7 +7151,7 @@ export {
|
|
|
7127
7151
|
p as HttpRequester,
|
|
7128
7152
|
re as Identity,
|
|
7129
7153
|
st as Image,
|
|
7130
|
-
|
|
7154
|
+
M as JwtPayload,
|
|
7131
7155
|
Pe as Manager,
|
|
7132
7156
|
Be as ManagerCommon,
|
|
7133
7157
|
ys as ManagerDataFactory,
|
|
@@ -7137,7 +7161,7 @@ export {
|
|
|
7137
7161
|
Rr as Operator,
|
|
7138
7162
|
B as Opf,
|
|
7139
7163
|
U as OpfEnum,
|
|
7140
|
-
|
|
7164
|
+
d as Order,
|
|
7141
7165
|
$t as OrderAction,
|
|
7142
7166
|
ws as OrderEditorData,
|
|
7143
7167
|
kr as OrderInfo,
|
|
@@ -7174,7 +7198,7 @@ export {
|
|
|
7174
7198
|
Yt as ProductCategoryDataProvider,
|
|
7175
7199
|
Xt as ProductDataProvider,
|
|
7176
7200
|
wt as ProductFileType,
|
|
7177
|
-
|
|
7201
|
+
je as ProductPriceCoefficient,
|
|
7178
7202
|
kt as ProductPriceHistory,
|
|
7179
7203
|
Qe as ProductUnit,
|
|
7180
7204
|
ss as PropertiesProvider,
|
|
@@ -7197,7 +7221,7 @@ export {
|
|
|
7197
7221
|
ot as StockCount,
|
|
7198
7222
|
is as TemplateProductCategoryDataProvider,
|
|
7199
7223
|
Et as TemplatesListFilters,
|
|
7200
|
-
|
|
7224
|
+
Me as TypedInstanceFactory,
|
|
7201
7225
|
Ir as UnitsHelper,
|
|
7202
7226
|
ps as UnknownClientDataProvider,
|
|
7203
7227
|
ur as UpdatableNamedIdentity,
|
|
@@ -7215,7 +7239,7 @@ export {
|
|
|
7215
7239
|
er as flattenCatalogItems,
|
|
7216
7240
|
fs as pluralize,
|
|
7217
7241
|
Se as useAuthStateStore,
|
|
7218
|
-
|
|
7242
|
+
I as useBaseConfigStateStore,
|
|
7219
7243
|
vs as useReferencesStore,
|
|
7220
7244
|
bs as useUserStateStore
|
|
7221
7245
|
};
|