@shopgate/pwa-common 7.12.2 → 7.12.3
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,4 +1,4 @@
|
|
|
1
|
-
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import IntlMessageFormat from'intl-messageformat';import curry from'lodash/curry';import messageCache from"./messageCache";/**
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import IntlMessageFormat from'intl-messageformat';import curry from'lodash/curry';import appConfig from'@shopgate/pwa-common/helpers/config';import messageCache from"./messageCache";var showPriceGrouping=appConfig.showPriceGrouping;/**
|
|
2
2
|
* Returns an instance of IntlMessageFormat from cache based on a hash.
|
|
3
3
|
* The hash is generated from given language code and translation key.
|
|
4
4
|
* If no instance exists yet, a new instance will be created and returned.
|
|
@@ -7,7 +7,7 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
|
|
|
7
7
|
* @param {boolean} fractions With or without fraction digits.
|
|
8
8
|
* @returns {IntlMessageFormat}
|
|
9
9
|
*/var getFormattedPriceFromCache=function getFormattedPriceFromCache(langCode,currency,fractions){var hash="".concat(langCode,"_price_").concat(currency,"_").concat(fractions);// Check if a cached instance already exists.
|
|
10
|
-
if(messageCache[hash]){return messageCache[hash];}messageCache[hash]=new IntlMessageFormat("{price, number, ".concat(currency,"}"),langCode,{number:_defineProperty({},currency,{style:'currency',currency:currency,minimumFractionDigits:fractions?2:0,maximumFractionDigits:fractions?2:0})});return messageCache[hash];};/**
|
|
10
|
+
if(messageCache[hash]){return messageCache[hash];}messageCache[hash]=new IntlMessageFormat("{price, number, ".concat(currency,"}"),langCode,{number:_defineProperty({},currency,{style:'currency',currency:currency,minimumFractionDigits:fractions?2:0,maximumFractionDigits:fractions?2:0,useGrouping:showPriceGrouping})});return messageCache[hash];};/**
|
|
11
11
|
* Get a formatted price by currency and language code.
|
|
12
12
|
* @param {string} langCode A language code.
|
|
13
13
|
* @param {number} price The price to format.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.3",
|
|
4
4
|
"description": "Common library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@sentry/browser": "6.0.1",
|
|
19
|
-
"@shopgate/pwa-benchmark": "7.12.
|
|
19
|
+
"@shopgate/pwa-benchmark": "7.12.3",
|
|
20
20
|
"@virtuous/conductor": "~2.5.0",
|
|
21
21
|
"@virtuous/react-conductor": "~2.5.0",
|
|
22
22
|
"@virtuous/redux-persister": "1.1.0-beta.7",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"url-search-params": "^0.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@shopgate/pwa-core": "7.12.
|
|
47
|
+
"@shopgate/pwa-core": "7.12.3",
|
|
48
48
|
"lodash": "^4.17.4",
|
|
49
49
|
"prop-types": "~15.7.2",
|
|
50
50
|
"react": "~16.12.0",
|