Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getFiatSymbol = (code: string) => {
// console.log('inside utils.getFiatSymbol, code is: ', code)
code = code.replace('iso:', '')
return getSymbolFromCurrency(code)
}
const prepareGraphData = (historyData) => {
if (!historyData || !historyData[0]) return {};
const currencySymbol = getSymbolFromCurrency(((first(historyData) || {}).price || {}).currency);
const valueAxisLabel = `${currencySymbol || '?'} / MWh`;
const priceMaxValue = d3Max(historyData.map(d => (d.price || {}).value));
const priceColorScale = scaleLinear()
.domain([0, priceMaxValue])
.range(['yellow', 'red']);
const data = historyData.map(d => ({
price: d.price && d.price.value,
datetime: moment(d.stateDatetime).toDate(),
// Keep a pointer to original data
meta: d,
}));
const layerKeys = ['price'];
const layerStroke = () => 'darkgray';
}
if (isError) {
return (
<div>
<p>Something went wrong. The payment couldn't be processed.</p>
</div>
);
}
return (
<div>
<form>
<label>
Amount ({getSymbolFromCurrency(CONFIGURATION.currency)}):
</label>
<input required="" value="{amount}" max="99999" min="1" type="number">
<label>Your Name (leave empty to stay anonymous):</label>
</form></div>
{!state.match(/REVERTED|DECLINED|FAILED/) && <>
{merchant && }
{!merchant && !isUser(recipient, sender) && !cashbackBoxId &&
}
{isUser(recipient, sender) && }
{cashbackBoxId && }
}
{state === 'PENDING' && }
{state === 'COMPLETED' && type === 'TRANSFER' && amount > 0 && }
{state === 'COMPLETED' && type === 'TRANSFER' && amount < 0 && }
{state === 'COMPLETED' && type === 'TRANSFER' && standingOrder && }
{merchant ? merchant.name : description}
{sign(amount)}{getSymbolFromCurrency(currency)}{amountFmt(amount)}
<spacer height=".25rem">
<time>
{moment(startedDate).format('MMM DD, HH:mm, YYYY')}
{state === 'REVERTED' && ', reverted'}
{state.match(/DECLINED|FAILED/) && ', declined'}
{state === 'PENDING' && ', pending'}
</time>
{counterpart && counterpart.currency !== currency &&
{sign(counterpart.amount)}{getSymbolFromCurrency(counterpart.currency)}{amountFmt(counterpart.amount)}}
</spacer>
;
getFormatted(value){
if(this.props.type){
if(this.props.type === 'price'){
let {options} = this.props;
let prefix = options.currency ? getSymbolFromCurrency(options.currency.value) : '';
return
}
}else{
return value;
}
}
const Currency = ({ currency = CONFIGURATION.currency }) => (
<span>{getSymbolFromCurrency(currency)}</span>
);
public symbol(code: string) {
return getSymbolFromCurrency(code);
}
export const changeCurrency = (currency, currencyRate) => dispatch => {
const symbol = getSymbolFromCurrency(currency);
setItem('currency', currency);
setItem('currency-rate', currencyRate);
setItem('currency-symbol', symbol);
dispatch(currencyChanged(currency, currencyRate, symbol));
};
let getRequestText = () => {
let serType = formJSON.type;
let trial = formJSON.trial_period_days !== 0;
let prefix = getSymbolFromCurrency(formJSON.currency);
if (trial) {
return ("Get your Free Trial")
}
else {
if (serType === "subscription") {
return (
<span>{"Subscribe "}
{formJSON.interval_count == 1 ? ' /' : ' / ' + formJSON.interval_count} {' ' + formJSON.interval}
</span>
);
} else if (serType === "one_time") {
return (
<span>{"Buy Now"} </span>
);
} else if (serType === "custom") {
static getFormattedRange(range) {
const currencySymbol = CurrencySymbol(range.currencyCode);
return `${currencySymbol}${range.low}-${currencySymbol}${range.high}`;
}