@snabcentr/common-lib 1.40.0 → 1.40.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.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -3
- package/dist/sc-common-lib.js +23 -23
- 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/catalog/classes/product-price-history.d.ts +1 -1
- package/dist/src/catalog/classes/product-price-history.d.ts.map +1 -1
- package/dist/src/catalog/interfaces/i-product-price-history.d.ts +1 -1
- package/dist/src/catalog/interfaces/i-product-price-history.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/manifest.json
CHANGED
package/dist/release_notes.tmp
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
## 1.40.
|
|
1
|
+
## 1.40.1 (2025-04-23)
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### fixed (1 change)
|
|
4
4
|
|
|
5
|
-
- [#
|
|
5
|
+
- [#11455: Исправлена ошибка преобразования даты истории цены](web_soft/libs/ts/snabcentr-common-lib@6d6cffc4dda729a38df971b1a498b3a08dea474c) ([merge request](web_soft/libs/ts/snabcentr-common-lib!63))
|
|
6
6
|
|
package/dist/sc-common-lib.js
CHANGED
|
@@ -2,7 +2,7 @@ var Fe = Object.defineProperty;
|
|
|
2
2
|
var je = (i, r, e) => r in i ? Fe(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
3
|
var s = (i, r, e) => je(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import { isUndefined as Te, cloneDeep as Ve, noop as m, toLower as Ee, isString as D, map as X, forEach as Ke, isNil as Je, isEmpty as Qe, isArray as Ye, isFunction as Xe } from "lodash-es";
|
|
5
|
-
import { format as Ze, addSeconds as er, parseISO as
|
|
5
|
+
import { format as Ze, addSeconds as er, parseISO as N, isAfter as rr, startOfToday as ge, parse as j, getDay as sr, startOfTomorrow as pe, nextMonday as tr, getUnixTime as k, endOfTomorrow as nr, endOfYesterday as ir, startOfYesterday as or, endOfToday as cr, endOfDay as lr, startOfDay as ur } from "date-fns";
|
|
6
6
|
import pr from "axios";
|
|
7
7
|
import { objectToSnake as Ae, objectToCamel as hr } from "ts-case-convert";
|
|
8
8
|
import { defineStore as ie } from "pinia";
|
|
@@ -264,7 +264,7 @@ const W = class W {
|
|
|
264
264
|
* Конфигурация приложения.
|
|
265
265
|
*/
|
|
266
266
|
s(W, "config");
|
|
267
|
-
let
|
|
267
|
+
let O = W;
|
|
268
268
|
class mr extends Le {
|
|
269
269
|
/**
|
|
270
270
|
* Инициализирует экземпляр класса {@link HiddenCatalogableItem}.
|
|
@@ -380,14 +380,14 @@ class x extends mr {
|
|
|
380
380
|
const t = (e == null ? void 0 : e.category) ?? ((o = e == null ? void 0 : e.categories) == null ? void 0 : o.find((h) => h.isPrimary));
|
|
381
381
|
t && (this.category = new me({ ...t, isPrimary: !0 }), this.categories = [this.category]), e != null && e.categories && (this.categories = e.categories.map((h) => new me(h))), this.images = ((l = e == null ? void 0 : e.images) == null ? void 0 : l.map((h) => {
|
|
382
382
|
var y;
|
|
383
|
-
return new fr(h, (y =
|
|
383
|
+
return new fr(h, (y = O.getConfig().urls) == null ? void 0 : y.mediaServer);
|
|
384
384
|
})) ?? [], this.properties = (e == null ? void 0 : e.properties) ?? {}, this.priceCoefficients = ((u = e == null ? void 0 : e.priceCoefficients) == null ? void 0 : u.map((h) => new ve(h))) ?? [], e && "codeNumber" in e && !e.code && (this.code = e == null ? void 0 : e.codeNumber);
|
|
385
385
|
}
|
|
386
386
|
/**
|
|
387
387
|
* Возвращает признак, что это измеряемый товар.
|
|
388
388
|
*/
|
|
389
389
|
getIsMeasurable() {
|
|
390
|
-
const e =
|
|
390
|
+
const e = O.getConfig().products.units;
|
|
391
391
|
return [...e.linear, ...e.square].includes(this.unit);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
@@ -719,7 +719,7 @@ const b = class b {
|
|
|
719
719
|
* - validationFieldResultData Список полей, для которых необходимо установить данные об ошибках валидации в случае ошибок в запросах.
|
|
720
720
|
*/
|
|
721
721
|
s(this, "defaultInstanceNotificationErrorResponseHandler", m);
|
|
722
|
-
const t =
|
|
722
|
+
const t = O.getConfig().version;
|
|
723
723
|
this.defaultInstanceNotificationErrorResponseHandler = b.baseDefaultNotificationErrorResponseHandler, this.httpClient = pr.create({
|
|
724
724
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
725
725
|
baseURL: r,
|
|
@@ -856,7 +856,7 @@ const z = class z extends fe {
|
|
|
856
856
|
* Время кэширования данных ответов на запросы (секунд).
|
|
857
857
|
*/
|
|
858
858
|
s(this, "responseDataCacheTimeout");
|
|
859
|
-
const n =
|
|
859
|
+
const n = O.getConfig();
|
|
860
860
|
this.responseDataCacheTimeout = n.http.responseDataCacheTimeout;
|
|
861
861
|
}
|
|
862
862
|
/**
|
|
@@ -910,7 +910,7 @@ class p extends ye {
|
|
|
910
910
|
*/
|
|
911
911
|
constructor() {
|
|
912
912
|
var t, n;
|
|
913
|
-
const r =
|
|
913
|
+
const r = O.getConfig(), e = {};
|
|
914
914
|
(t = r.devMode) != null && t.authBearerToken && (e.Authorization = `Bearer ${(n = r.devMode) == null ? void 0 : n.authBearerToken}`), super(`${r.http.apiUri}/api`, e);
|
|
915
915
|
}
|
|
916
916
|
}
|
|
@@ -1018,7 +1018,7 @@ class ts extends p {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
1020
|
var xe = /* @__PURE__ */ ((i) => (i.Discount = "discount", i.PriceTemplate = "price_template", i.ClientPrice = "client_price", i.Product = "product", i))(xe || {}), Pr = /* @__PURE__ */ ((i) => (i.Unknown = "unknown", i.Bool = "bool", i.Integer = "integer", i.Float = "float", i.String = "string", i.Range = "range", i.Json = "json", i.Object = "object", i))(Pr || {}), Ar = /* @__PURE__ */ ((i) => (i.K0 = "k0", i.K1 = "k1", i.K2 = "k2", i.K3 = "k3", i.K4 = "k4", i))(Ar || {});
|
|
1021
|
-
class
|
|
1021
|
+
class d extends oe {
|
|
1022
1022
|
/**
|
|
1023
1023
|
* Инициализирует экземпляр класса {@link Category}.
|
|
1024
1024
|
*
|
|
@@ -1035,7 +1035,7 @@ class O extends oe {
|
|
|
1035
1035
|
* Список продуктов категории.
|
|
1036
1036
|
*/
|
|
1037
1037
|
s(this, "products");
|
|
1038
|
-
this.categories = (t = e == null ? void 0 : e.categories) == null ? void 0 : t.map((o) => new
|
|
1038
|
+
this.categories = (t = e == null ? void 0 : e.categories) == null ? void 0 : t.map((o) => new d(o)), this.products = (n = e == null ? void 0 : e.products) == null ? void 0 : n.map((o) => new x(o));
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
class ke extends P {
|
|
@@ -1065,7 +1065,7 @@ class $r extends ke {
|
|
|
1065
1065
|
* Дата и время последнего удаления в формате Y-m-d H:i:s.
|
|
1066
1066
|
*/
|
|
1067
1067
|
s(this, "deletedAt");
|
|
1068
|
-
this.deletedAt = e != null && e.deletedAt ? D(e.deletedAt) ?
|
|
1068
|
+
this.deletedAt = e != null && e.deletedAt ? D(e.deletedAt) ? N(e.deletedAt) : e.deletedAt : void 0;
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
1071
|
class ns {
|
|
@@ -1079,7 +1079,7 @@ class ns {
|
|
|
1079
1079
|
if (e)
|
|
1080
1080
|
try {
|
|
1081
1081
|
const t = JSON.parse(e);
|
|
1082
|
-
if (rr(
|
|
1082
|
+
if (rr(N(t.availableFor) || ge(), /* @__PURE__ */ new Date()))
|
|
1083
1083
|
return t.data || {};
|
|
1084
1084
|
} catch {
|
|
1085
1085
|
localStorage.removeItem(r);
|
|
@@ -1153,7 +1153,7 @@ class br extends P {
|
|
|
1153
1153
|
* Дата и время удаления в формате Y-m-d H:i:s.
|
|
1154
1154
|
*/
|
|
1155
1155
|
s(this, "deletedAt");
|
|
1156
|
-
this.costCoefficient = (e == null ? void 0 : e.costCoefficient) ?? 0, this.isLowPriceAllowed = (e == null ? void 0 : e.isLowPriceAllowed) ?? !1, this.publishedAt = e != null && e.publishedAt ? D(e.publishedAt) ?
|
|
1156
|
+
this.costCoefficient = (e == null ? void 0 : e.costCoefficient) ?? 0, this.isLowPriceAllowed = (e == null ? void 0 : e.isLowPriceAllowed) ?? !1, this.publishedAt = e != null && e.publishedAt ? D(e.publishedAt) ? N(e.publishedAt) : e.publishedAt : void 0, this.description = (e == null ? void 0 : e.description) ?? void 0, this.percent = (e == null ? void 0 : e.percent) ?? 0, this.owner = new U(e == null ? void 0 : e.owner), this.deletedAt = e != null && e.deletedAt ? D(e.deletedAt) ? N(e.deletedAt) : e.deletedAt : void 0;
|
|
1157
1157
|
}
|
|
1158
1158
|
}
|
|
1159
1159
|
class Sr extends ke {
|
|
@@ -1172,7 +1172,7 @@ class Sr extends ke {
|
|
|
1172
1172
|
* Дата и время создания шаблона.
|
|
1173
1173
|
*/
|
|
1174
1174
|
s(this, "createdAt");
|
|
1175
|
-
this.description = (e == null ? void 0 : e.description) ?? "", this.createdAt = e != null && e.createdAt ? D(e.createdAt) ?
|
|
1175
|
+
this.description = (e == null ? void 0 : e.description) ?? "", this.createdAt = e != null && e.createdAt ? D(e.createdAt) ? N(e.createdAt) : e.createdAt : /* @__PURE__ */ new Date();
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
1178
|
class le extends x {
|
|
@@ -1637,7 +1637,7 @@ class qe extends P {
|
|
|
1637
1637
|
* Признак активности учетной записи пользователя.
|
|
1638
1638
|
*/
|
|
1639
1639
|
s(this, "isActive");
|
|
1640
|
-
this.phone = /^\d+$/.test((e == null ? void 0 : e.phone) ?? "") ? `+${e == null ? void 0 : e.phone}` : (e == null ? void 0 : e.phone) ?? "", this.email = (e == null ? void 0 : e.email) ?? "", this.getNews = (e == null ? void 0 : e.getNews) ?? !1, this.salesDirection = e != null && e.salesDirection ? new S(e.salesDirection) : void 0, this.createdAt = D(e == null ? void 0 : e.createdAt) ?
|
|
1640
|
+
this.phone = /^\d+$/.test((e == null ? void 0 : e.phone) ?? "") ? `+${e == null ? void 0 : e.phone}` : (e == null ? void 0 : e.phone) ?? "", this.email = (e == null ? void 0 : e.email) ?? "", this.getNews = (e == null ? void 0 : e.getNews) ?? !1, this.salesDirection = e != null && e.salesDirection ? new S(e.salesDirection) : void 0, this.createdAt = D(e == null ? void 0 : e.createdAt) ? N(e.createdAt) : e == null ? void 0 : e.createdAt, this.lastLoginAt = D(e == null ? void 0 : e.lastLoginAt) ? N(e.lastLoginAt) : e == null ? void 0 : e.lastLoginAt, this.isActive = (e == null ? void 0 : e.isActive) ?? !1;
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
1643
1643
|
class Or extends qe {
|
|
@@ -1715,7 +1715,7 @@ class Ur {
|
|
|
1715
1715
|
* Данные о валюте.
|
|
1716
1716
|
*/
|
|
1717
1717
|
s(this, "currency");
|
|
1718
|
-
this.cost = r.cost, this.costDate = r.costDate, this.isLowCost = r.isLowCost, this.isRetail = r.isRetail, this.discountName = r.discountName, this.priceTemplateName = r.priceTemplateName, this.client = r.client ? new U(r.client) : void 0, this.executor = r.executor ? new U(r.executor) : void 0, this.currency = r.currency ? new se(r.currency) : void 0;
|
|
1718
|
+
this.cost = r.cost, this.costDate = D(r.costDate) ? N(r.costDate) : r.costDate, this.isLowCost = r.isLowCost, this.isRetail = r.isRetail, this.discountName = r.discountName, this.priceTemplateName = r.priceTemplateName, this.client = r.client ? new U(r.client) : void 0, this.executor = r.executor ? new U(r.executor) : void 0, this.currency = r.currency ? new se(r.currency) : void 0;
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
1721
|
class $e {
|
|
@@ -1733,7 +1733,7 @@ class $e {
|
|
|
1733
1733
|
* Список рекомендованных категорий продуктов.
|
|
1734
1734
|
*/
|
|
1735
1735
|
s(this, "productCategories", []);
|
|
1736
|
-
r != null && r.products && (this.products = r.products.map((e) => new x(e))), r != null && r.productCategories && (this.productCategories = r.productCategories.map((e) => new
|
|
1736
|
+
r != null && r.products && (this.products = r.products.map((e) => new x(e))), r != null && r.productCategories && (this.productCategories = r.productCategories.map((e) => new d(e)));
|
|
1737
1737
|
}
|
|
1738
1738
|
}
|
|
1739
1739
|
class B extends P {
|
|
@@ -1807,7 +1807,7 @@ class os extends p {
|
|
|
1807
1807
|
*/
|
|
1808
1808
|
// eslint-disable-next-line class-methods-use-this
|
|
1809
1809
|
getPriceExportLink(r = "csv", e = !1, t = void 0) {
|
|
1810
|
-
let o = `${
|
|
1810
|
+
let o = `${O.getConfig().http.apiUri}/api/internal/price/export?format=${r}&show_hidden=${e}`;
|
|
1811
1811
|
return t && (o += `&client_id=${t}`), o;
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
@@ -1825,7 +1825,7 @@ class cs extends p {
|
|
|
1825
1825
|
{
|
|
1826
1826
|
showHidden: r
|
|
1827
1827
|
},
|
|
1828
|
-
(e) => e.data.map((t) => new
|
|
1828
|
+
(e) => e.data.map((t) => new d(t))
|
|
1829
1829
|
);
|
|
1830
1830
|
}
|
|
1831
1831
|
/**
|
|
@@ -1844,7 +1844,7 @@ class cs extends p {
|
|
|
1844
1844
|
showHidden: e,
|
|
1845
1845
|
withNestedCategories: t
|
|
1846
1846
|
},
|
|
1847
|
-
(n) => new
|
|
1847
|
+
(n) => new d(n.data)
|
|
1848
1848
|
);
|
|
1849
1849
|
}
|
|
1850
1850
|
/**
|
|
@@ -1853,7 +1853,7 @@ class cs extends p {
|
|
|
1853
1853
|
* @param categoryID Идентификатор категории продуктов.
|
|
1854
1854
|
*/
|
|
1855
1855
|
getPublicCategoryData(r) {
|
|
1856
|
-
return this.get(`/public/catalog/categories/${r}`, {}, (e) => new
|
|
1856
|
+
return this.get(`/public/catalog/categories/${r}`, {}, (e) => new d(e.data));
|
|
1857
1857
|
}
|
|
1858
1858
|
/**
|
|
1859
1859
|
* Возвращает список продуктов категории.
|
|
@@ -1896,7 +1896,7 @@ class cs extends p {
|
|
|
1896
1896
|
publicSimpleSearch(r, e = 10) {
|
|
1897
1897
|
return new Promise((t, n) => {
|
|
1898
1898
|
this.get(`/public/catalog/search/simple?limit=${e}&term=${r}`).then((o) => {
|
|
1899
|
-
t(o.categories.map((l) => new
|
|
1899
|
+
t(o.categories.map((l) => new d(l)));
|
|
1900
1900
|
}).catch((o) => {
|
|
1901
1901
|
n(o);
|
|
1902
1902
|
});
|
|
@@ -4835,7 +4835,7 @@ class Ts {
|
|
|
4835
4835
|
export {
|
|
4836
4836
|
Lr as AnyReference,
|
|
4837
4837
|
ss as AppBaseConfig,
|
|
4838
|
-
|
|
4838
|
+
O as AppConfigProvider,
|
|
4839
4839
|
we as BankAccount,
|
|
4840
4840
|
De as BasePaginationProvider,
|
|
4841
4841
|
Y as Cart,
|
|
@@ -4844,7 +4844,7 @@ export {
|
|
|
4844
4844
|
ts as CartProvider,
|
|
4845
4845
|
os as CatalogProvider,
|
|
4846
4846
|
Le as CatalogableItem,
|
|
4847
|
-
|
|
4847
|
+
d as Category,
|
|
4848
4848
|
qr as CategoryPricingRole,
|
|
4849
4849
|
Oe as ChannelPrimaryInterest,
|
|
4850
4850
|
is as City,
|