@arcteryx/components-price
Advanced tools
Comparing version 1.2.1 to 2.0.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [2.0.0](http://bitbucket.org/arcteryx/arcteryx-js-helpers/compare/@arcteryx/components-price@1.2.1...@arcteryx/components-price@2.0.0) (2020-09-21) | ||
### Bug Fixes | ||
* **Node:** Downgrade Node.js version from v13 to LTS v12; Skip price test :( ([c2cdcc4](http://bitbucket.org/arcteryx/arcteryx-js-helpers/commits/c2cdcc44bf45a394b4765f54d87bcc6706ed5108)) | ||
### BREAKING CHANGES | ||
* **Node:** Bundled with IE11 polyfill removal, Rollup Upgrade | ||
## [1.2.1](http://bitbucket.org/arcteryx/arcteryx-js-helpers/compare/@arcteryx/components-price@1.2.0...@arcteryx/components-price@1.2.1) (2020-08-24) | ||
@@ -8,0 +24,0 @@ |
@@ -5,3 +5,2 @@ 'use strict'; | ||
require('regenerator-runtime'); | ||
var React = require('react'); | ||
@@ -11,49 +10,11 @@ var React__default = _interopDefault(React); | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
const priceFormat = (price, currencyCode, _country, _language, _currencyDisplay = "symbol") => { | ||
let formattedPrice = ""; | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
let country = _country.toUpperCase(); | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
let language = _language.toLowerCase(); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
let currencyDisplay = _currencyDisplay; | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
var priceFormat = function priceFormat(price, currencyCode, _country, _language) { | ||
var _currencyDisplay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "symbol"; | ||
var formattedPrice = ""; | ||
var country = _country.toUpperCase(); | ||
var language = _language.toLowerCase(); | ||
var currencyDisplay = _currencyDisplay; | ||
if (price !== null && price !== "") { | ||
@@ -90,3 +51,3 @@ if (language === "jp") { | ||
var locale = "".concat(language, "-").concat(country); // ex: en-CA, ja-JP, fr-CA | ||
const locale = `${language}-${country}`; // ex: en-CA, ja-JP, fr-CA | ||
@@ -96,3 +57,3 @@ formattedPrice = new Intl.NumberFormat(locale, { | ||
currency: currencyCode, | ||
currencyDisplay: currencyDisplay | ||
currencyDisplay | ||
}).format(price); // formattedPrice = Number(price).toLocaleString(locale, { style: "currency", currency: currencyCode, currencyDisplay }); | ||
@@ -108,52 +69,12 @@ | ||
var fetchPriceList = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(country) { | ||
var url, | ||
sessionStorage, | ||
list, | ||
_args = arguments; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
url = _args.length > 1 && _args[1] !== undefined ? _args[1] : "//price-api.arcteryx.com"; | ||
sessionStorage = _args.length > 2 && _args[2] !== undefined ? _args[2] : window.sessionStorage; | ||
country = country.toUpperCase(); //eslint-disable-line | ||
_context.next = 5; | ||
return fetch("".concat(url, "/").concat(country, ".json")); | ||
case 5: | ||
list = _context.sent; | ||
_context.next = 8; | ||
return list.json(); | ||
case 8: | ||
list = _context.sent; | ||
sessionStorage.setItem("SalePriceList".concat(country), JSON.stringify(list)); | ||
return _context.abrupt("return", list); | ||
case 11: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return function fetchPriceList(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
var Price = function Price(_ref) { | ||
var price = _ref.price, | ||
currency = _ref.currency, | ||
className = _ref.className; | ||
var _useContext = React.useContext(componentsContexts.SiteContext), | ||
country = _useContext.country, | ||
language = _useContext.language; | ||
var formattedPrice = priceFormat(price, currency, country, language); | ||
const Price = ({ | ||
price, | ||
currency, | ||
className | ||
}) => { | ||
const { | ||
country, | ||
language | ||
} = React.useContext(componentsContexts.SiteContext); | ||
const formattedPrice = priceFormat(price, currency, country, language); | ||
return /*#__PURE__*/React__default.createElement("span", { | ||
@@ -160,0 +81,0 @@ className: className |
@@ -1,52 +0,13 @@ | ||
import 'regenerator-runtime'; | ||
import React, { useContext } from 'react'; | ||
import { SiteContext } from '@arcteryx/components-contexts'; | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
const priceFormat = (price, currencyCode, _country, _language, _currencyDisplay = "symbol") => { | ||
let formattedPrice = ""; | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
let country = _country.toUpperCase(); | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
let language = _language.toLowerCase(); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
let currencyDisplay = _currencyDisplay; | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
var priceFormat = function priceFormat(price, currencyCode, _country, _language) { | ||
var _currencyDisplay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "symbol"; | ||
var formattedPrice = ""; | ||
var country = _country.toUpperCase(); | ||
var language = _language.toLowerCase(); | ||
var currencyDisplay = _currencyDisplay; | ||
if (price !== null && price !== "") { | ||
@@ -83,3 +44,3 @@ if (language === "jp") { | ||
var locale = "".concat(language, "-").concat(country); // ex: en-CA, ja-JP, fr-CA | ||
const locale = `${language}-${country}`; // ex: en-CA, ja-JP, fr-CA | ||
@@ -89,3 +50,3 @@ formattedPrice = new Intl.NumberFormat(locale, { | ||
currency: currencyCode, | ||
currencyDisplay: currencyDisplay | ||
currencyDisplay | ||
}).format(price); // formattedPrice = Number(price).toLocaleString(locale, { style: "currency", currency: currencyCode, currencyDisplay }); | ||
@@ -101,52 +62,12 @@ | ||
var fetchPriceList = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(country) { | ||
var url, | ||
sessionStorage, | ||
list, | ||
_args = arguments; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
url = _args.length > 1 && _args[1] !== undefined ? _args[1] : "//price-api.arcteryx.com"; | ||
sessionStorage = _args.length > 2 && _args[2] !== undefined ? _args[2] : window.sessionStorage; | ||
country = country.toUpperCase(); //eslint-disable-line | ||
_context.next = 5; | ||
return fetch("".concat(url, "/").concat(country, ".json")); | ||
case 5: | ||
list = _context.sent; | ||
_context.next = 8; | ||
return list.json(); | ||
case 8: | ||
list = _context.sent; | ||
sessionStorage.setItem("SalePriceList".concat(country), JSON.stringify(list)); | ||
return _context.abrupt("return", list); | ||
case 11: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return function fetchPriceList(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
var Price = function Price(_ref) { | ||
var price = _ref.price, | ||
currency = _ref.currency, | ||
className = _ref.className; | ||
var _useContext = useContext(SiteContext), | ||
country = _useContext.country, | ||
language = _useContext.language; | ||
var formattedPrice = priceFormat(price, currency, country, language); | ||
const Price = ({ | ||
price, | ||
currency, | ||
className | ||
}) => { | ||
const { | ||
country, | ||
language | ||
} = useContext(SiteContext); | ||
const formattedPrice = priceFormat(price, currency, country, language); | ||
return /*#__PURE__*/React.createElement("span", { | ||
@@ -153,0 +74,0 @@ className: className |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('regenerator-runtime'), require('react'), require('@arcteryx/components-contexts')) : | ||
typeof define === 'function' && define.amd ? define(['regenerator-runtime', 'react', '@arcteryx/components-contexts'], factory) : | ||
(function() { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('@arcteryx/components-contexts')) : | ||
typeof define === 'function' && define.amd ? define(['react', '@arcteryx/components-contexts'], factory) : | ||
(global = global || self, (function () { | ||
var current = global.ARCTERYX && global.ARCTERYX.componentsprice; | ||
var exports = factory(null,global.React,global.componentsContexts); | ||
global.ARCTERYX.componentsprice = exports; | ||
exports.noConflict = function() { global.ARCTERYX.componentsprice = current; return exports; }; | ||
})(); | ||
}(this, (function (regeneratorRuntime$1,React,componentsContexts) { 'use strict'; | ||
var exports = (global.ARCTERYX = global.ARCTERYX || {}, global.ARCTERYX.componentsprice = factory(global.React, global.componentsContexts)); | ||
exports.noConflict = function () { global.ARCTERYX.componentsprice = current; return exports; }; | ||
}())); | ||
}(this, (function (React, componentsContexts) { 'use strict'; | ||
var React__default = 'default' in React ? React['default'] : React; | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
try { | ||
var info = gen[key](arg); | ||
var value = info.value; | ||
} catch (error) { | ||
reject(error); | ||
return; | ||
} | ||
const priceFormat = (price, currencyCode, _country, _language, _currencyDisplay = "symbol") => { | ||
let formattedPrice = ""; | ||
if (info.done) { | ||
resolve(value); | ||
} else { | ||
Promise.resolve(value).then(_next, _throw); | ||
} | ||
} | ||
let country = _country.toUpperCase(); | ||
function _asyncToGenerator(fn) { | ||
return function () { | ||
var self = this, | ||
args = arguments; | ||
return new Promise(function (resolve, reject) { | ||
var gen = fn.apply(self, args); | ||
let language = _language.toLowerCase(); | ||
function _next(value) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
} | ||
let currencyDisplay = _currencyDisplay; | ||
function _throw(err) { | ||
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
} | ||
_next(undefined); | ||
}); | ||
}; | ||
} | ||
var priceFormat = function priceFormat(price, currencyCode, _country, _language) { | ||
var _currencyDisplay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "symbol"; | ||
var formattedPrice = ""; | ||
var country = _country.toUpperCase(); | ||
var language = _language.toLowerCase(); | ||
var currencyDisplay = _currencyDisplay; | ||
if (price !== null && price !== "") { | ||
@@ -92,3 +53,3 @@ if (language === "jp") { | ||
var locale = "".concat(language, "-").concat(country); // ex: en-CA, ja-JP, fr-CA | ||
const locale = `${language}-${country}`; // ex: en-CA, ja-JP, fr-CA | ||
@@ -98,3 +59,3 @@ formattedPrice = new Intl.NumberFormat(locale, { | ||
currency: currencyCode, | ||
currencyDisplay: currencyDisplay | ||
currencyDisplay | ||
}).format(price); // formattedPrice = Number(price).toLocaleString(locale, { style: "currency", currency: currencyCode, currencyDisplay }); | ||
@@ -110,52 +71,12 @@ | ||
var fetchPriceList = /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(country) { | ||
var url, | ||
sessionStorage, | ||
list, | ||
_args = arguments; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
url = _args.length > 1 && _args[1] !== undefined ? _args[1] : "//price-api.arcteryx.com"; | ||
sessionStorage = _args.length > 2 && _args[2] !== undefined ? _args[2] : window.sessionStorage; | ||
country = country.toUpperCase(); //eslint-disable-line | ||
_context.next = 5; | ||
return fetch("".concat(url, "/").concat(country, ".json")); | ||
case 5: | ||
list = _context.sent; | ||
_context.next = 8; | ||
return list.json(); | ||
case 8: | ||
list = _context.sent; | ||
sessionStorage.setItem("SalePriceList".concat(country), JSON.stringify(list)); | ||
return _context.abrupt("return", list); | ||
case 11: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return function fetchPriceList(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
var Price = function Price(_ref) { | ||
var price = _ref.price, | ||
currency = _ref.currency, | ||
className = _ref.className; | ||
var _useContext = React.useContext(componentsContexts.SiteContext), | ||
country = _useContext.country, | ||
language = _useContext.language; | ||
var formattedPrice = priceFormat(price, currency, country, language); | ||
const Price = ({ | ||
price, | ||
currency, | ||
className | ||
}) => { | ||
const { | ||
country, | ||
language | ||
} = React.useContext(componentsContexts.SiteContext); | ||
const formattedPrice = priceFormat(price, currency, country, language); | ||
return /*#__PURE__*/React__default.createElement("span", { | ||
@@ -162,0 +83,0 @@ className: className |
{ | ||
"name": "@arcteryx/components-price", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "Arcteryx Price", | ||
@@ -13,8 +13,8 @@ "source": "src/index.js", | ||
"start": "../node_modules/.bin/rollup -c ../scripts/rollup.config.js -w", | ||
"test": "jest --coverage", | ||
"test:watch": "jest --watch" | ||
"test": "../node_modules/.bin/jest --coverage", | ||
"test:watch": "../node_modules/.bin/jest --watch" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"gitHead": "074799a683c67e11ae1402b30c40a2f5b5d5fd2f", | ||
"gitHead": "11c9f784fc2486ff049c47888b0cf66c4655cf40", | ||
"peerDependencies": { | ||
@@ -24,3 +24,3 @@ "@arcteryx/components-contexts": "^1.1.0" | ||
"dependencies": { | ||
"@arcteryx/js-price": "^1.31.0" | ||
"@arcteryx/js-price": "^2.0.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
0
48894
242
+ Added@arcteryx/js-price@2.2.0(transitive)
- Removed@arcteryx/js-price@1.31.0(transitive)
- Removedregenerator-runtime@0.13.11(transitive)
Updated@arcteryx/js-price@^2.0.0