@veloceapps/sdk 7.0.2-77 → 7.0.2-79
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, InjectionToken, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
|
3
|
-
import { UUID, ConfigurationContextMode, ConfigurationContext, RuntimeModel, getUIDefinitionProperties, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT,
|
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, RuntimeModel, getUIDefinitionProperties, isLegacyUIDefinition, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, EntityUtil, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, parseJsonSafely, formatNumber } from '@veloceapps/core';
|
|
4
4
|
import * as i1 from '@veloceapps/api';
|
|
5
5
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
|
6
6
|
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1, of, tap as tap$1, map as map$2, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
|
@@ -1542,16 +1542,23 @@ class RuntimeSettingsService {
|
|
|
1542
1542
|
const currencySettings = this.getCurrencySettings();
|
|
1543
1543
|
const dateFormat = (validateDateFormat(shoppingCartSettings?.DATE_FORMAT ?? '') && shoppingCartSettings?.DATE_FORMAT) ||
|
|
1544
1544
|
DEFAULT_DATE_FORMAT;
|
|
1545
|
-
const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR
|
|
1546
|
-
const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR
|
|
1545
|
+
const decimalSeparator = shoppingCartSettings?.DECIMAL_SEPARATOR;
|
|
1546
|
+
const thousandsSeparator = shoppingCartSettings?.THOUSANDS_SEPARATOR;
|
|
1547
|
+
// the number of decimal places can be 0
|
|
1548
|
+
const priceScale = shoppingCartSettings?.PRICE_SCALE;
|
|
1549
|
+
const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
|
|
1550
|
+
? Number(priceScale)
|
|
1551
|
+
: DEFAULT_DECIMALS_COUNT;
|
|
1547
1552
|
return {
|
|
1548
1553
|
currencySymbol: currencySettings.symbol,
|
|
1549
1554
|
dateFormats: getSupportedDateFormats(dateFormat),
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
+
decimalsCount,
|
|
1556
|
+
decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
|
|
1557
|
+
? decimalSeparator
|
|
1558
|
+
: DEFAULT_DECIMAL_SEPARATOR,
|
|
1559
|
+
// thousands separator can be a blank value, so it can also be null
|
|
1560
|
+
thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
|
|
1561
|
+
? thousandsSeparator || ''
|
|
1555
1562
|
: DEFAULT_THOUSANDS_SEPARATOR,
|
|
1556
1563
|
};
|
|
1557
1564
|
}
|