@snabcentr/client-core 3.23.0 → 3.23.4
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/esm2022/catalog/dto/sc-product.mjs +5 -4
- package/esm2022/helpers/index.mjs +2 -1
- package/esm2022/helpers/sc-number-helper.mjs +210 -0
- package/esm2022/order/classes/sc-delivery-cost.mjs +4 -3
- package/esm2022/order/classes/sc-order-base.mjs +3 -2
- package/esm2022/order/classes/sc-order-draft.mjs +3 -2
- package/esm2022/order/classes/sc-order-item.mjs +6 -5
- package/esm2022/order/services/sc-order-drafts.service.mjs +3 -2
- package/esm2022/references/index.mjs +2 -1
- package/esm2022/references/sc-rub-precision.providers.mjs +22 -0
- package/esm2022/suggestion/dto/sc-i-suggestion-address.mjs +1 -1
- package/esm2022/suggestion/dto/sc-i-suggestion-organization.mjs +1 -1
- package/esm2022/suggestion/enums/sc-suggestion-address-quality.mjs +20 -0
- package/esm2022/suggestion/index.mjs +2 -1
- package/esm2022/user/dto/sc-user.mjs +4 -3
- package/fesm2022/snabcentr-client-core.mjs +265 -18
- package/fesm2022/snabcentr-client-core.mjs.map +1 -1
- package/helpers/index.d.ts +1 -0
- package/helpers/sc-number-helper.d.ts +153 -0
- package/package.json +1 -1
- package/references/index.d.ts +1 -0
- package/references/sc-rub-precision.providers.d.ts +6 -0
- package/release_notes.tmp +3 -3
- package/suggestion/dto/sc-i-suggestion-address.d.ts +5 -0
- package/suggestion/dto/sc-i-suggestion-organization.d.ts +14 -1
- package/suggestion/enums/sc-suggestion-address-quality.d.ts +17 -0
- package/suggestion/index.d.ts +1 -0
- package/user/dto/sc-user.d.ts +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as i1 from 'rxjs';
|
|
2
|
-
import { of, startWith as startWith$1, Subject, ReplaySubject, partition, combineLatest, map as map$1, debounceTime, switchMap, tap, filter, shareReplay, distinctUntilChanged, BehaviorSubject, materialize, dematerialize, merge, distinctUntilKeyChanged, skip, first, catchError as catchError$1, throwError, expand, takeWhile, toArray, EMPTY, take, defaultIfEmpty, concatMap, finalize, takeUntil, interval, share, scan, defer, from, lastValueFrom, timeout, TimeoutError } from 'rxjs';
|
|
2
|
+
import { of, startWith as startWith$1, Subject, ReplaySubject, partition, combineLatest, map as map$1, debounceTime, switchMap, tap, filter, shareReplay, distinctUntilChanged, BehaviorSubject, materialize, dematerialize, merge, distinctUntilKeyChanged, skip, first, catchError as catchError$1, throwError, expand, takeWhile, toArray, EMPTY, take, defaultIfEmpty, concatMap, finalize, takeUntil, ignoreElements, interval, share, scan, defer, from, lastValueFrom, timeout, TimeoutError } from 'rxjs';
|
|
3
3
|
import { map, startWith, catchError } from 'rxjs/operators';
|
|
4
4
|
import { parseISO, parse, isValid, format } from 'date-fns';
|
|
5
5
|
import { isString, isNil, isMatch, isArray, omit, get } from 'lodash-es';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { InjectionToken, inject, PLATFORM_ID, Injectable, Inject, Optional, EventEmitter, DestroyRef, LOCALE_ID, Pipe, assertInInjectionContext, RendererFactory2
|
|
7
|
+
import { InjectionToken, inject, PLATFORM_ID, Injectable, Inject, Optional, EventEmitter, DestroyRef, LOCALE_ID, Pipe, makeEnvironmentProviders, APP_INITIALIZER, assertInInjectionContext, RendererFactory2 } from '@angular/core';
|
|
8
8
|
import { WA_LOCAL_STORAGE, WA_USER_AGENT, WA_WINDOW } from '@ng-web-apis/common';
|
|
9
9
|
import { filterByKey, toValue, WA_STORAGE_EVENT, StorageService } from '@ng-web-apis/storage';
|
|
10
10
|
import { isPlatformBrowser, isPlatformServer, DOCUMENT, formatDate } from '@angular/common';
|
|
11
11
|
import * as i1$1 from '@angular/common/http';
|
|
12
12
|
import { HttpContextToken, HttpContext, HttpHeaders, HttpClient, HttpParams, HttpErrorResponse, HttpResponse, FetchBackend, HttpXhrBackend, HttpStatusCode, HttpBackend } from '@angular/common/http';
|
|
13
13
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
14
|
-
import { tuiIsPresent, TuiDay, tuiPure, TUI_TRUE_HANDLER } from '@taiga-ui/cdk';
|
|
14
|
+
import { tuiRound, tuiIsPresent, TuiDay, tuiPure, TUI_TRUE_HANDLER } from '@taiga-ui/cdk';
|
|
15
|
+
import { tuiFormatNumber } from '@taiga-ui/core';
|
|
15
16
|
import { tuiCleanObject } from '@taiga-ui/addon-doc/utils';
|
|
16
17
|
import * as i2 from '@angular/router';
|
|
17
18
|
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
|
|
@@ -1214,6 +1215,214 @@ class ScBanner {
|
|
|
1214
1215
|
}
|
|
1215
1216
|
}
|
|
1216
1217
|
|
|
1218
|
+
/**
|
|
1219
|
+
* Класс-помощник для работы с дробными числами.
|
|
1220
|
+
*
|
|
1221
|
+
* Округляет с учётом погрешности дробной арифметики, считает кратность шагу и задаёт настройки вывода чисел.
|
|
1222
|
+
*/
|
|
1223
|
+
class ScNumberHelper {
|
|
1224
|
+
/**
|
|
1225
|
+
* Наибольшее количество знаков после запятой в проценте на экране.
|
|
1226
|
+
*/
|
|
1227
|
+
static { this.percentDisplayFractionDigits = 2; }
|
|
1228
|
+
/**
|
|
1229
|
+
* Наибольшее количество знаков после запятой в площади, м².
|
|
1230
|
+
*/
|
|
1231
|
+
static { this.areaFractionDigits = 4; }
|
|
1232
|
+
/**
|
|
1233
|
+
* Количество знаков после запятой в географических координатах.
|
|
1234
|
+
*/
|
|
1235
|
+
static { this.coordinateFractionDigits = 6; }
|
|
1236
|
+
/**
|
|
1237
|
+
* Количество значащих цифр, до которого обрезается погрешность дробной арифметики.
|
|
1238
|
+
*/
|
|
1239
|
+
static { this.significantDigits = 12; }
|
|
1240
|
+
/**
|
|
1241
|
+
* Допустимая погрешность сравнения дробных чисел.
|
|
1242
|
+
*/
|
|
1243
|
+
static { this.epsilon = 0.000001; }
|
|
1244
|
+
/**
|
|
1245
|
+
* Настройки вывода площади.
|
|
1246
|
+
*/
|
|
1247
|
+
static { this.areaFormat = {
|
|
1248
|
+
precision: ScNumberHelper.areaFractionDigits,
|
|
1249
|
+
decimalSeparator: ',',
|
|
1250
|
+
decimalMode: 'not-zero',
|
|
1251
|
+
rounding: 'round',
|
|
1252
|
+
}; }
|
|
1253
|
+
/**
|
|
1254
|
+
* Настройки вывода целых чисел.
|
|
1255
|
+
*/
|
|
1256
|
+
static { this.integerFormat = {
|
|
1257
|
+
precision: 0,
|
|
1258
|
+
rounding: 'round',
|
|
1259
|
+
}; }
|
|
1260
|
+
/**
|
|
1261
|
+
* Настройки вывода процентов.
|
|
1262
|
+
*/
|
|
1263
|
+
static { this.percentFormat = {
|
|
1264
|
+
precision: ScNumberHelper.percentDisplayFractionDigits,
|
|
1265
|
+
decimalSeparator: ',',
|
|
1266
|
+
decimalMode: 'not-zero',
|
|
1267
|
+
rounding: 'round',
|
|
1268
|
+
}; }
|
|
1269
|
+
/**
|
|
1270
|
+
* Настройки вывода денежных сумм по точности валюты.
|
|
1271
|
+
*/
|
|
1272
|
+
static { this.moneyFormatsByPrecision = new Map(); }
|
|
1273
|
+
/**
|
|
1274
|
+
* Точность рубля из справочника валют ({@link ScICurrency.precision}) или undefined, если справочник не загружен.
|
|
1275
|
+
*/
|
|
1276
|
+
static get rubPrecision() {
|
|
1277
|
+
return ScNumberHelper.rubPrecisionValue;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Возвращает количество знаков после запятой в указанном числе с учётом экспоненциальной записи.
|
|
1281
|
+
*
|
|
1282
|
+
* @param value Число, для которого нужно определить количество знаков после запятой.
|
|
1283
|
+
*/
|
|
1284
|
+
static getDecimalsCount(value) {
|
|
1285
|
+
if (!Number.isFinite(value) || Number.isInteger(value)) {
|
|
1286
|
+
return 0;
|
|
1287
|
+
}
|
|
1288
|
+
const [mantissa, exponent] = value.toString().split('e');
|
|
1289
|
+
const mantissaParts = mantissa.split('.');
|
|
1290
|
+
const decimals = mantissaParts.length > 1 ? mantissaParts[1].length : 0;
|
|
1291
|
+
return Math.max(decimals - (Number(exponent) || 0), 0);
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Возвращает число без погрешности дробной арифметики.
|
|
1295
|
+
*
|
|
1296
|
+
* @param value Число с возможной погрешностью.
|
|
1297
|
+
*/
|
|
1298
|
+
static normalize(value) {
|
|
1299
|
+
return Number.isFinite(value) ? Number(value.toPrecision(ScNumberHelper.significantDigits)) : value;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Возвращает значение, округлённое до указанного количества знаков после запятой.
|
|
1303
|
+
*
|
|
1304
|
+
* @param value Округляемое значение.
|
|
1305
|
+
* @param fractionDigits Количество знаков после запятой.
|
|
1306
|
+
*/
|
|
1307
|
+
static round(value, fractionDigits) {
|
|
1308
|
+
return tuiRound(value, fractionDigits);
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Запоминает точность рубля из справочника валют.
|
|
1312
|
+
*
|
|
1313
|
+
* @param precision Точность рубля ({@link ScICurrency.precision}).
|
|
1314
|
+
*/
|
|
1315
|
+
static setRubPrecision(precision) {
|
|
1316
|
+
ScNumberHelper.rubPrecisionValue = precision;
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* Возвращает денежную сумму, округлённую до точности валюты.
|
|
1320
|
+
*
|
|
1321
|
+
* Без известной точности убирает только погрешность дробной арифметики.
|
|
1322
|
+
*
|
|
1323
|
+
* @param value Денежная сумма.
|
|
1324
|
+
* @param precision Точность валюты суммы ({@link ScICurrency.precision}), по умолчанию точность рубля.
|
|
1325
|
+
*/
|
|
1326
|
+
static roundMoney(value, precision = ScNumberHelper.rubPrecision) {
|
|
1327
|
+
return precision === undefined ? ScNumberHelper.normalize(value) : ScNumberHelper.round(value, precision);
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Возвращает географическую координату, округлённую до точности хранения.
|
|
1331
|
+
*
|
|
1332
|
+
* @param value Координата.
|
|
1333
|
+
*/
|
|
1334
|
+
static roundCoordinate(value) {
|
|
1335
|
+
return ScNumberHelper.round(value, ScNumberHelper.coordinateFractionDigits);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Возвращает произведение значения на шаг, округлённое до точности множителей.
|
|
1339
|
+
*
|
|
1340
|
+
* @param value Множитель, обычно количество.
|
|
1341
|
+
* @param step Шаг.
|
|
1342
|
+
*/
|
|
1343
|
+
static multiplyByStep(value, step) {
|
|
1344
|
+
return ScNumberHelper.round(value * step, ScNumberHelper.getDecimalsCount(step) + ScNumberHelper.getDecimalsCount(value));
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Возвращает частное от деления значения на шаг без погрешности дробной арифметики.
|
|
1348
|
+
*
|
|
1349
|
+
* @param value Делимое, обычно длина или количество.
|
|
1350
|
+
* @param step Шаг.
|
|
1351
|
+
*/
|
|
1352
|
+
static divideByStep(value, step) {
|
|
1353
|
+
return ScNumberHelper.withoutNegativeZero(ScNumberHelper.normalize(value / step));
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Возвращает сумму значения и шага, округлённую до точности слагаемых.
|
|
1357
|
+
*
|
|
1358
|
+
* @param value Значение.
|
|
1359
|
+
* @param step Шаг.
|
|
1360
|
+
*/
|
|
1361
|
+
static addStep(value, step) {
|
|
1362
|
+
return ScNumberHelper.round(value + step, Math.max(ScNumberHelper.getDecimalsCount(value), ScNumberHelper.getDecimalsCount(step)));
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Возвращает остаток от деления значения на шаг без погрешности дробной арифметики.
|
|
1366
|
+
*
|
|
1367
|
+
* @param value Значение.
|
|
1368
|
+
* @param step Шаг.
|
|
1369
|
+
*/
|
|
1370
|
+
static remainder(value, step) {
|
|
1371
|
+
const quotient = Math.floor(ScNumberHelper.divideByStep(value, step));
|
|
1372
|
+
return ScNumberHelper.round(value - quotient * step, Math.max(ScNumberHelper.getDecimalsCount(value), ScNumberHelper.getDecimalsCount(step)));
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Возвращает значение, приведённое к ближайшему кратному шагу, с точностью шага.
|
|
1376
|
+
*
|
|
1377
|
+
* @param value Значение.
|
|
1378
|
+
* @param step Шаг.
|
|
1379
|
+
*/
|
|
1380
|
+
static snapToStep(value, step) {
|
|
1381
|
+
return ScNumberHelper.multiplyByStep(Math.round(ScNumberHelper.divideByStep(value, step)), step);
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Возвращает признак того, что значение кратно шагу с учётом погрешности дробной арифметики.
|
|
1385
|
+
*
|
|
1386
|
+
* @param value Значение.
|
|
1387
|
+
* @param step Шаг.
|
|
1388
|
+
*/
|
|
1389
|
+
static isMultipleOf(value, step) {
|
|
1390
|
+
const quotient = value / step;
|
|
1391
|
+
return Math.abs(quotient - Math.round(quotient)) < ScNumberHelper.epsilon;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Возвращает настройки вывода денежной суммы с числом знаков после запятой, равным точности валюты.
|
|
1395
|
+
*
|
|
1396
|
+
* @param precision Точность валюты суммы ({@link ScICurrency.precision}), по умолчанию точность рубля.
|
|
1397
|
+
*/
|
|
1398
|
+
static getMoneyFormat(precision = ScNumberHelper.rubPrecision) {
|
|
1399
|
+
const formatPrecision = precision ?? Number.POSITIVE_INFINITY;
|
|
1400
|
+
let format = ScNumberHelper.moneyFormatsByPrecision.get(formatPrecision);
|
|
1401
|
+
if (!format) {
|
|
1402
|
+
format = { precision: formatPrecision, decimalSeparator: ',', decimalMode: 'always', rounding: 'round' };
|
|
1403
|
+
ScNumberHelper.moneyFormatsByPrecision.set(formatPrecision, format);
|
|
1404
|
+
}
|
|
1405
|
+
return format;
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Возвращает денежную сумму в виде строки с разделителями разрядов и числом знаков после запятой, равным точности валюты.
|
|
1409
|
+
*
|
|
1410
|
+
* @param value Денежная сумма.
|
|
1411
|
+
* @param precision Точность валюты суммы ({@link ScICurrency.precision}), по умолчанию точность рубля.
|
|
1412
|
+
*/
|
|
1413
|
+
static formatMoney(value, precision = ScNumberHelper.rubPrecision) {
|
|
1414
|
+
return tuiFormatNumber(ScNumberHelper.roundMoney(value, precision), ScNumberHelper.getMoneyFormat(precision));
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Возвращает число, в котором отрицательный ноль заменён на ноль.
|
|
1418
|
+
*
|
|
1419
|
+
* @param value Число.
|
|
1420
|
+
*/
|
|
1421
|
+
static withoutNegativeZero(value) {
|
|
1422
|
+
return value === 0 ? 0 : value;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1217
1426
|
/**
|
|
1218
1427
|
* Перечисление типов клиента.
|
|
1219
1428
|
*/
|
|
@@ -1284,10 +1493,10 @@ class ScUser {
|
|
|
1284
1493
|
return this.userType === ScUserType.guest;
|
|
1285
1494
|
}
|
|
1286
1495
|
/**
|
|
1287
|
-
*
|
|
1496
|
+
* Задолженность по модулю, округлённая до точности рубля.
|
|
1288
1497
|
*/
|
|
1289
1498
|
get absDebt() {
|
|
1290
|
-
return Math.abs(this.debt ?? 0);
|
|
1499
|
+
return ScNumberHelper.roundMoney(Math.abs(this.debt ?? 0));
|
|
1291
1500
|
}
|
|
1292
1501
|
}
|
|
1293
1502
|
|
|
@@ -1772,19 +1981,19 @@ class ScProduct extends ScCatalogItem {
|
|
|
1772
1981
|
* Стоимость товара или услуги с валютой и единицей измерения.
|
|
1773
1982
|
*/
|
|
1774
1983
|
get costString() {
|
|
1775
|
-
return this.cost ? `${this.cost.
|
|
1984
|
+
return this.cost ? `${ScNumberHelper.formatMoney(this.cost, this.currency.precision)} ${this.currency.symbol} / ${this.unit.name}` : '';
|
|
1776
1985
|
}
|
|
1777
1986
|
/**
|
|
1778
1987
|
* Стоимость товара или услуги в рублях и с единицей измерения.
|
|
1779
1988
|
*/
|
|
1780
1989
|
get costRubString() {
|
|
1781
|
-
return this.costRub ? `${this.costRub
|
|
1990
|
+
return this.costRub ? `${ScNumberHelper.formatMoney(this.costRub)} ₽ / ${this.unit.name}` : '';
|
|
1782
1991
|
}
|
|
1783
1992
|
/**
|
|
1784
1993
|
* Стоимость товара или услуги с валютой и единицей измерения до применения скидки.
|
|
1785
1994
|
*/
|
|
1786
1995
|
get discountCostString() {
|
|
1787
|
-
return this.discount?.oldCost ? `${this.discount.oldCost.
|
|
1996
|
+
return this.discount?.oldCost ? `${ScNumberHelper.formatMoney(this.discount.oldCost, this.currency.precision)} ${this.currency.symbol} / ${this.unit.name}` : '';
|
|
1788
1997
|
}
|
|
1789
1998
|
/**
|
|
1790
1999
|
* Признак, что товар продаётся в рублях.
|
|
@@ -1898,25 +2107,25 @@ class ScOrderItem {
|
|
|
1898
2107
|
* @inheritDoc
|
|
1899
2108
|
*/
|
|
1900
2109
|
getCostPerItem() {
|
|
1901
|
-
return this.costOne > 0 ? `${this.costOne.
|
|
2110
|
+
return this.costOne > 0 ? `${ScNumberHelper.formatMoney(this.costOne, this.product.currency.precision)} ${this.product.currency.symbol}` : '-';
|
|
1902
2111
|
}
|
|
1903
2112
|
/**
|
|
1904
2113
|
* @inheritDoc
|
|
1905
2114
|
*/
|
|
1906
2115
|
getCostInCurrencyDescPerItem() {
|
|
1907
|
-
return this.costOne > 0 ? `${this.costOne.
|
|
2116
|
+
return this.costOne > 0 ? `${ScNumberHelper.formatMoney(this.costOne, this.product.currency.precision)} ${this.product.currency.symbol} / ${this.product.unit.name}` : '-';
|
|
1908
2117
|
}
|
|
1909
2118
|
/**
|
|
1910
2119
|
* @inheritDoc
|
|
1911
2120
|
*/
|
|
1912
2121
|
getCostInRubDescPerItem() {
|
|
1913
|
-
return this.costOneRub > 0 ? `${this.costOneRub
|
|
2122
|
+
return this.costOneRub > 0 ? `${ScNumberHelper.formatMoney(this.costOneRub)} ₽ / ${this.product.unit.name}` : '-';
|
|
1914
2123
|
}
|
|
1915
2124
|
/**
|
|
1916
2125
|
* @inheritDoc
|
|
1917
2126
|
*/
|
|
1918
2127
|
getCostRubStr() {
|
|
1919
|
-
return this.costRub > 0 ? `${this.costRub
|
|
2128
|
+
return this.costRub > 0 ? `${ScNumberHelper.formatMoney(this.costRub)} ₽` : '-';
|
|
1920
2129
|
}
|
|
1921
2130
|
/**
|
|
1922
2131
|
* @inheritDoc
|
|
@@ -6312,6 +6521,24 @@ var ScReclamationStatus;
|
|
|
6312
6521
|
ScReclamationStatus[ScReclamationStatus["completed"] = 4] = "completed";
|
|
6313
6522
|
})(ScReclamationStatus || (ScReclamationStatus = {}));
|
|
6314
6523
|
|
|
6524
|
+
/**
|
|
6525
|
+
* Возвращает загрузку точности рубля из справочника валют при старте приложения.
|
|
6526
|
+
*
|
|
6527
|
+
* @param referencesService Сервис справочников.
|
|
6528
|
+
*/
|
|
6529
|
+
function loadRubPrecision(referencesService) {
|
|
6530
|
+
return () => referencesService.currencies$.pipe(tap((currencies) => {
|
|
6531
|
+
ScNumberHelper.setRubPrecision(currencies.find((currency) => currency.signature === 'RUB')?.precision);
|
|
6532
|
+
}), ignoreElements(), catchError$1(() => EMPTY));
|
|
6533
|
+
}
|
|
6534
|
+
/**
|
|
6535
|
+
* Возвращает провайдеры загрузки точности рубля из справочника валют при старте приложения.
|
|
6536
|
+
* По этой точности {@link ScNumberHelper} округляет и выводит рублёвые суммы.
|
|
6537
|
+
*/
|
|
6538
|
+
function provideRubPrecision() {
|
|
6539
|
+
return makeEnvironmentProviders([{ provide: APP_INITIALIZER, multi: true, deps: [ScReferencesService], useFactory: loadRubPrecision }]);
|
|
6540
|
+
}
|
|
6541
|
+
|
|
6315
6542
|
/**
|
|
6316
6543
|
* Сервис для получения списков стран, регионов, городов.
|
|
6317
6544
|
*/
|
|
@@ -6734,8 +6961,8 @@ class ScDeliveryCost {
|
|
|
6734
6961
|
constructor(deliveryCost, deliveryDate) {
|
|
6735
6962
|
if (deliveryCost.freeShippingTerms?.minOrdersSum !== undefined && deliveryCost.freeShippingTerms.currentOrdersSum !== undefined) {
|
|
6736
6963
|
this.freeShippingTerms = { minOrdersSum: deliveryCost.freeShippingTerms.minOrdersSum, currentOrdersSum: deliveryCost.freeShippingTerms.currentOrdersSum };
|
|
6737
|
-
this.message = `Для оформления бесплатной доставки сумма заказов на ${deliveryDate} должна быть более ${this.freeShippingTerms.minOrdersSum
|
|
6738
|
-
Текущая сумма заказов составляет ${this.freeShippingTerms.currentOrdersSum
|
|
6964
|
+
this.message = `Для оформления бесплатной доставки сумма заказов на ${deliveryDate} должна быть более ${ScNumberHelper.formatMoney(this.freeShippingTerms.minOrdersSum)} руб.<br>
|
|
6965
|
+
Текущая сумма заказов составляет ${ScNumberHelper.formatMoney(this.freeShippingTerms.currentOrdersSum)} руб`;
|
|
6739
6966
|
}
|
|
6740
6967
|
}
|
|
6741
6968
|
}
|
|
@@ -6758,7 +6985,7 @@ class ScOrderBase {
|
|
|
6758
6985
|
* @inheritDoc
|
|
6759
6986
|
*/
|
|
6760
6987
|
getSumStr() {
|
|
6761
|
-
return this.sum && this.sum > 0 ? `${this.sum
|
|
6988
|
+
return this.sum && this.sum > 0 ? `${ScNumberHelper.formatMoney(this.sum)} ₽` : '-';
|
|
6762
6989
|
}
|
|
6763
6990
|
/**
|
|
6764
6991
|
* @inheritDoc
|
|
@@ -6793,7 +7020,7 @@ class ScOrderDraft {
|
|
|
6793
7020
|
* @inheritDoc
|
|
6794
7021
|
*/
|
|
6795
7022
|
getSumStr() {
|
|
6796
|
-
return this.sum > 0 ? `${this.sum
|
|
7023
|
+
return this.sum > 0 ? `${ScNumberHelper.formatMoney(this.sum)} ₽` : '-';
|
|
6797
7024
|
}
|
|
6798
7025
|
/**
|
|
6799
7026
|
* @inheritDoc
|
|
@@ -7197,7 +7424,7 @@ class ScOrderDraftsService {
|
|
|
7197
7424
|
}
|
|
7198
7425
|
const updatedDraft = new ScOrderDraft(currentDraft);
|
|
7199
7426
|
updatedDraft.products = remainingProducts;
|
|
7200
|
-
updatedDraft.sum = remainingProducts.reduce((sum, product) => sum + product.costRub, 0);
|
|
7427
|
+
updatedDraft.sum = ScNumberHelper.roundMoney(remainingProducts.reduce((sum, product) => sum + product.costRub, 0));
|
|
7201
7428
|
cachedItem.setValue(updatedDraft);
|
|
7202
7429
|
});
|
|
7203
7430
|
}
|
|
@@ -8944,6 +9171,26 @@ var ScISuggestionType;
|
|
|
8944
9171
|
ScISuggestionType["email"] = "email";
|
|
8945
9172
|
})(ScISuggestionType || (ScISuggestionType = {}));
|
|
8946
9173
|
|
|
9174
|
+
/**
|
|
9175
|
+
* Перечисление значений качества (полноты) адреса в подсказках.
|
|
9176
|
+
*/
|
|
9177
|
+
// eslint-disable-next-line no-shadow
|
|
9178
|
+
var ScSuggestionAddressQuality;
|
|
9179
|
+
(function (ScSuggestionAddressQuality) {
|
|
9180
|
+
/**
|
|
9181
|
+
* Не удалось определить полноту адреса.
|
|
9182
|
+
*/
|
|
9183
|
+
ScSuggestionAddressQuality[ScSuggestionAddressQuality["undetermined"] = 0] = "undetermined";
|
|
9184
|
+
/**
|
|
9185
|
+
* Полный адрес.
|
|
9186
|
+
*/
|
|
9187
|
+
ScSuggestionAddressQuality[ScSuggestionAddressQuality["complete"] = 1] = "complete";
|
|
9188
|
+
/**
|
|
9189
|
+
* Неполный адрес (уровень детализации в ФИАС ниже порогового).
|
|
9190
|
+
*/
|
|
9191
|
+
ScSuggestionAddressQuality[ScSuggestionAddressQuality["incomplete"] = 2] = "incomplete";
|
|
9192
|
+
})(ScSuggestionAddressQuality || (ScSuggestionAddressQuality = {}));
|
|
9193
|
+
|
|
8947
9194
|
/**
|
|
8948
9195
|
* Сервис работы с API подсказок.
|
|
8949
9196
|
*/
|
|
@@ -9295,5 +9542,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
9295
9542
|
* Generated bundle index. Do not edit.
|
|
9296
9543
|
*/
|
|
9297
9544
|
|
|
9298
|
-
export { CATEGORY_PROVIDERS, EMPTY_CART, IS_BROWSER, IS_RUNNING_ON_TERMINAL, IS_SERVER, RESPONSE, SC_ACCESS_AUTH_TOKEN_STORAGE_KEY, SC_API_KEYS, SC_AUTH_ADD_HEADER_REQUIRED, SC_AUTH_AS_CLIENT_DEFAULT_OPTIONS, SC_AUTH_AS_CLIENT_OPTIONS, SC_CACHE_LIFETIME, SC_CACHE_SETTINGS, SC_CANONICAL_REDIRECT_ENABLED, SC_CATALOG_ITEM_PAGE_META, SC_CATALOG_ROOT_PAGE_META, SC_CATEGORY_INFO, SC_CATEGORY_STATE, SC_COMPANY_INFO, SC_COMPANY_NAME, SC_CONFIGURATOR_COMPONENTS, SC_CONFIGURATOR_SETTINGS, SC_COUNT_FIRST_DISCOUNTED_PRODUCTS, SC_COUNT_LAST_NEWS, SC_DATE_FORMAT, SC_DEFAULT_PAGE_META, SC_FEEDBACK_API, SC_GUEST_ENDPOINTS_TOKEN, SC_GUEST_PARAMETER_NAME_TOKEN, SC_GUEST_TOKEN_STORAGE_KEY, SC_ID_OR_SLUG_IN_ROUTE, SC_IS_HEADER_REQUIRED, SC_IS_HIDDEN_ERROR_ALERT, SC_IS_HIDDEN_ERROR_ALERT_HTTP_CONTEXT, SC_IS_LOGOUT_REQUEST, SC_IS_REFRESH_REQUIRED, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_MAX_LENGTH_SEARCH_TERM, SC_MIN_LENGTH_SEARCH_TERM, SC_NEXT_PAGE_PAGINATION_CLICK, SC_ORDER_LOADER, SC_ORDER_LOADING, SC_PAGE_QUERY_PARAM, SC_PATH_IMAGE_NOT_FOUND, SC_PRODUCTS_PAGINATION_LOADER, SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS, SC_PRODUCT_PAGINATION_OPTIONS, SC_REFRESH_AUTH_TOKEN_STORAGE_KEY, SC_RELEASE, SC_SSR_RESPONSE_CACHE, SC_SSR_RESPONSE_CACHE_SETTINGS, SC_UPDATE_INTERVAL, SC_URLS, SC_USER_INFO, SC_VACANCIES_DATA_SOURCE, SC_VIRTUAL_CATEGORY_INFO, SC_VIRTUAL_CATEGORY_PROVIDERS, SEARCH_TERM, SEARCH_TERM_PROVIDERS, ScAuthAsClientGuard, ScAuthInterceptor, ScAuthService, ScBanner, ScBannerService, ScCacheInterceptor, ScCacheSettings, ScCachedData, ScCachedItem, ScCart, ScCartService, ScCatalogFilterService, ScCatalogFormat, ScCatalogItem, ScCatalogRedirectService, ScCatalogService, ScCatalogableItem, ScCategory, ScClientType, ScCodedIdentity, ScConfiguratorService, ScContactsService, ScContragentService, ScConvertInterceptor, ScConvertersService, ScDateFormatInterceptor, ScDeletableNamedIdentity, ScDeliveryAddressService, ScDeliveryCost, ScDeliveryType, ScDocumentInfoNode, ScDocumentInfoTypesEnum, ScErrorRequestState, ScErrorsInterceptor, ScFavoriteService, ScFeedbackForms, ScFeedbackService, ScFilesService, ScFrequentlyAskedQuestionsService, ScGuestInterceptor, ScHiddenCatalogableItem, ScIBreadcrumbItem, ScISuggestionType, ScIconTypesEnum, ScIdOrSlugGuard, ScIdOrSlugPipe, ScIdentity, ScImage, ScImageHelper, ScLoadingRequestState, ScLocationsService, ScMediaImageTransformerPipe, ScMimeTypes, ScNamedIdentity, ScNews, ScNewsService, ScNotificationActionTypes, ScNotificationLevelNames, ScNotificationsService, ScOpfList, ScOptionsInterceptor, ScOrder, ScOrderBase, ScOrderDraft, ScOrderDraftShort, ScOrderDraftType, ScOrderDraftsService, ScOrderItem, ScOrderShort, ScOrderStateStatus, ScOrdersService, ScPaginationPageQueryParamService, ScPaginationService, ScPaymentStatus, ScPaymentType, ScPhoneService, ScPrimaryCatalogableItem, ScProduct, ScProductTileType, ScQuestionnaireService, ScQuestionnaireStatusEnum, ScReclamationService, ScReclamationStatus, ScRecommendationService, ScRedirectStatusEnum, ScReference, ScReferenceName, ScReferencesService, ScRequestStateStatusEnum, ScRequisitesService, ScRouteKeys, ScSearchService, ScSeoService, ScSocialType, ScSsrResponseCache, ScSsrResponseCacheBackend, ScSuccessRequestState, ScSuggestionService, ScSum, ScTokenService, ScUIService, ScUTMService, ScUnitsHelper, ScUpdatableNamedIdentity, ScUploadedFile, ScUser, ScUserMetadata, ScUserMetrikaGoalsEnum, ScUserMetrikaService, ScUserService, ScUserType, ScVCardService, ScVacanciesList, ScVacanciesService, ScVacancy, ScVerificationService, ScVirtualCategory, ScWarehouseService, SchemaOrgFactory, TERMINAL_PROVIDERS, USER_AGENT_TERMINAL, filterChangedByKey, loadingPlaceholder, mapRequestStateToDataOrNull, mapToRequestState, provideSsrResponseCache, runningOnTerminalFactory, scGetCurrentRoute, scGetPageQueryParamChanges, scOrderIsLoaded, scParsePageQueryParam, searchTermFactory };
|
|
9545
|
+
export { CATEGORY_PROVIDERS, EMPTY_CART, IS_BROWSER, IS_RUNNING_ON_TERMINAL, IS_SERVER, RESPONSE, SC_ACCESS_AUTH_TOKEN_STORAGE_KEY, SC_API_KEYS, SC_AUTH_ADD_HEADER_REQUIRED, SC_AUTH_AS_CLIENT_DEFAULT_OPTIONS, SC_AUTH_AS_CLIENT_OPTIONS, SC_CACHE_LIFETIME, SC_CACHE_SETTINGS, SC_CANONICAL_REDIRECT_ENABLED, SC_CATALOG_ITEM_PAGE_META, SC_CATALOG_ROOT_PAGE_META, SC_CATEGORY_INFO, SC_CATEGORY_STATE, SC_COMPANY_INFO, SC_COMPANY_NAME, SC_CONFIGURATOR_COMPONENTS, SC_CONFIGURATOR_SETTINGS, SC_COUNT_FIRST_DISCOUNTED_PRODUCTS, SC_COUNT_LAST_NEWS, SC_DATE_FORMAT, SC_DEFAULT_PAGE_META, SC_FEEDBACK_API, SC_GUEST_ENDPOINTS_TOKEN, SC_GUEST_PARAMETER_NAME_TOKEN, SC_GUEST_TOKEN_STORAGE_KEY, SC_ID_OR_SLUG_IN_ROUTE, SC_IS_HEADER_REQUIRED, SC_IS_HIDDEN_ERROR_ALERT, SC_IS_HIDDEN_ERROR_ALERT_HTTP_CONTEXT, SC_IS_LOGOUT_REQUEST, SC_IS_REFRESH_REQUIRED, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_MAX_LENGTH_SEARCH_TERM, SC_MIN_LENGTH_SEARCH_TERM, SC_NEXT_PAGE_PAGINATION_CLICK, SC_ORDER_LOADER, SC_ORDER_LOADING, SC_PAGE_QUERY_PARAM, SC_PATH_IMAGE_NOT_FOUND, SC_PRODUCTS_PAGINATION_LOADER, SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS, SC_PRODUCT_PAGINATION_OPTIONS, SC_REFRESH_AUTH_TOKEN_STORAGE_KEY, SC_RELEASE, SC_SSR_RESPONSE_CACHE, SC_SSR_RESPONSE_CACHE_SETTINGS, SC_UPDATE_INTERVAL, SC_URLS, SC_USER_INFO, SC_VACANCIES_DATA_SOURCE, SC_VIRTUAL_CATEGORY_INFO, SC_VIRTUAL_CATEGORY_PROVIDERS, SEARCH_TERM, SEARCH_TERM_PROVIDERS, ScAuthAsClientGuard, ScAuthInterceptor, ScAuthService, ScBanner, ScBannerService, ScCacheInterceptor, ScCacheSettings, ScCachedData, ScCachedItem, ScCart, ScCartService, ScCatalogFilterService, ScCatalogFormat, ScCatalogItem, ScCatalogRedirectService, ScCatalogService, ScCatalogableItem, ScCategory, ScClientType, ScCodedIdentity, ScConfiguratorService, ScContactsService, ScContragentService, ScConvertInterceptor, ScConvertersService, ScDateFormatInterceptor, ScDeletableNamedIdentity, ScDeliveryAddressService, ScDeliveryCost, ScDeliveryType, ScDocumentInfoNode, ScDocumentInfoTypesEnum, ScErrorRequestState, ScErrorsInterceptor, ScFavoriteService, ScFeedbackForms, ScFeedbackService, ScFilesService, ScFrequentlyAskedQuestionsService, ScGuestInterceptor, ScHiddenCatalogableItem, ScIBreadcrumbItem, ScISuggestionType, ScIconTypesEnum, ScIdOrSlugGuard, ScIdOrSlugPipe, ScIdentity, ScImage, ScImageHelper, ScLoadingRequestState, ScLocationsService, ScMediaImageTransformerPipe, ScMimeTypes, ScNamedIdentity, ScNews, ScNewsService, ScNotificationActionTypes, ScNotificationLevelNames, ScNotificationsService, ScNumberHelper, ScOpfList, ScOptionsInterceptor, ScOrder, ScOrderBase, ScOrderDraft, ScOrderDraftShort, ScOrderDraftType, ScOrderDraftsService, ScOrderItem, ScOrderShort, ScOrderStateStatus, ScOrdersService, ScPaginationPageQueryParamService, ScPaginationService, ScPaymentStatus, ScPaymentType, ScPhoneService, ScPrimaryCatalogableItem, ScProduct, ScProductTileType, ScQuestionnaireService, ScQuestionnaireStatusEnum, ScReclamationService, ScReclamationStatus, ScRecommendationService, ScRedirectStatusEnum, ScReference, ScReferenceName, ScReferencesService, ScRequestStateStatusEnum, ScRequisitesService, ScRouteKeys, ScSearchService, ScSeoService, ScSocialType, ScSsrResponseCache, ScSsrResponseCacheBackend, ScSuccessRequestState, ScSuggestionAddressQuality, ScSuggestionService, ScSum, ScTokenService, ScUIService, ScUTMService, ScUnitsHelper, ScUpdatableNamedIdentity, ScUploadedFile, ScUser, ScUserMetadata, ScUserMetrikaGoalsEnum, ScUserMetrikaService, ScUserService, ScUserType, ScVCardService, ScVacanciesList, ScVacanciesService, ScVacancy, ScVerificationService, ScVirtualCategory, ScWarehouseService, SchemaOrgFactory, TERMINAL_PROVIDERS, USER_AGENT_TERMINAL, filterChangedByKey, loadingPlaceholder, mapRequestStateToDataOrNull, mapToRequestState, provideRubPrecision, provideSsrResponseCache, runningOnTerminalFactory, scGetCurrentRoute, scGetPageQueryParamChanges, scOrderIsLoaded, scParsePageQueryParam, searchTermFactory };
|
|
9299
9546
|
//# sourceMappingURL=snabcentr-client-core.mjs.map
|