Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const packageIds = Object.keys( selectedRates );
// Show the service name and cost when only one service/package exists
if ( 1 === packageIds.length ) {
const packageId = packageIds[ 0 ];
const selectedRate = selectedRates[ packageId ];
const packageRates = get( availableRates, [ packageId, 'rates' ], [] );
const rateInfo = find( packageRates, [ 'service_id', selectedRate ] );
if ( rateInfo ) {
return translate( '%(serviceName)s: %(rate)s', {
args: {
serviceName: rateInfo.title,
rate: formatCurrency( rateInfo.rate, 'USD' ),
},
} );
}
return '';
}
// Otherwise, just show the total
return translate( 'Total rate: %(total)s', {
args: {
total: formatCurrency( total, 'USD' ),
},
} );
};
{
args: {
amount: formatCurrency( subscriber.plan.renewal_price, subscriber.plan.currency ),
formattedDate: this.props.moment( subscriber.start_date ).format( 'll' ),
total: formatCurrency( subscriber.all_time_total, subscriber.plan.currency ),
},
}
);
} else if ( subscriber.plan.renew_interval === '1 month' ) {
return this.props.translate(
'Paying %(amount)s/month since %(formattedDate)s. Total of %(total)s.',
{
args: {
amount: formatCurrency( subscriber.plan.renewal_price, subscriber.plan.currency ),
formattedDate: this.props.moment( subscriber.start_date ).format( 'll' ),
total: formatCurrency( subscriber.all_time_total, subscriber.plan.currency ),
},
}
);
}
}
renderSubscriberActions( subscriber ) {
{ translate(
'Give the Premium plan a risk-free test drive with our {{u}}30-day Money Back Guarantee{{/u}}.',
{
components: { u: <u> },
}
) }
<p></p>
<p>
<b>
{ translate(
'Upgrade to the Premium plan and access over 250 premium themes for just {{del}}%(fullPrice)s{{/del}} %(discountPrice)s more.',
{
components: { del: <del> },
args: {
bundleValue: formatCurrency( bundleValue, currencyCode, { precision: 0 } ),
fullPrice: formatCurrency( planRawPrice, currencyCode, { stripZeros: true } ),
discountPrice: formatCurrency( planDiscountedRawPrice, currencyCode, {
stripZeros: true,
} ),
},
}
) }
</del></b>
</p>
<div>
<img src="{" alt="Website expert offering a support session">
</div></u>
export function myFormatCurrency( price, code, options = {} ) {
const precision = CURRENCIES[ code ].precision;
const EPSILON = Math.pow( 10, -precision ) - 0.000000001;
const hasCents = Math.abs( price % 1 ) >= EPSILON;
return formatCurrency( price, code, hasCents ? options : { ...options, precision: 0 } );
}
render() {
if ( ! this.props.currentPlan && ! this.props.forceDisplay ) {
return null;
}
const price = formatCurrency( this.props.plan.raw_price / 12, this.props.plan.currency_code );
const features = this.props.planConstants
.getPlanCompareFeatures()
.filter( feature => feature !== this.props.highlightedFeature )
.slice( 0, 6 );
return (
<div>
</div>
export const getMethodSummary = ( method, currency ) => {
if ( startsWith( method.methodType, 'wc_services' ) ) {
return translate( 'Live rates calculated at checkout' );
}
switch ( method.methodType ) {
case 'free_shipping':
if ( ! method.requires ) {
return translate( 'Free for everyone' );
}
return translate( 'Minimum order amount: %s', {
args: [ formatCurrency( method.min_amount, currency ) || method.min_amount ],
} );
case 'flat_rate':
case 'local_pickup':
return formatCurrency( method.cost, currency ) || method.cost;
default:
return '';
}
};
<li>
<span>
{ translate( 'Last 30 days', { context: 'Sum of earnings over last 30 days' } ) }
</span>
<span>
{ formatCurrency( this.props.lastMonth, this.props.currency ) }
</span>
</li>
<li>
<span>
{ translate( 'Next month', {
context: 'Forecast for the subscriptions due in the next 30 days',
} ) }
</span>
<span>
{ formatCurrency( this.props.forecast, this.props.currency ) }
</span>
</li>
<div>
{ translate(
'On your current plan, WordPress.com charges {{em}}%(commission)s{{/em}}.{{br/}} Additionally, Stripe charges are typically %(stripe)s. {{a}}Learn more{{/a}}',
{
args: {
commission: '' + parseFloat( this.props.commission ) * 100 + '%',
stripe: '2.9%+30c',
},
components: {
em: <em>,
br: <br>,
a: (</em></div>
/>
<span>
{ translate( "{{b}}And more:{{/b}} Tell our experts what you'd like to cover.", {
components: { b: <b> },
comment: "This is a benefit listed on a 'Purchase a call with us' page",
} ) }
</b></span><b>
<h4>
{ translate(
'Reserve a 45-minute "Quick Start" appointment, and save %(saveAmount)s if you sign up today.',
{
args: {
saveAmount: formatCurrency( savings, currencyCode, { stripZeros: true } ),
},
}
) }
</h4>
<p>
<b>
{ translate(
'Book your call today for just {{del}}%(oldPrice)s{{/del}} %(price)s.',
{
components: { del: <del> },
args: {
oldPrice: formatCurrency( fullCost, currencyCode, { stripZeros: true } ),
price: productDisplayCost,
},
}</del></b></p></b>
getDiscountTooltipMessage() {
const { currencyCode, currentSitePlan, translate, rawPrice } = this.props;
if ( planMatches( currentSitePlan.productSlug, { type: TYPE_FREE } ) ) {
return translate( 'Price for the next 12 months' );
}
const price = formatCurrency( rawPrice, currencyCode );
return translate(
"You'll receive a discount from the full price of %(price)s because you already have a plan.",
{ args: { price } }
);
}