PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8
GiveWP – Donation Plugin and Fundraising Platform v4.16.8
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Campaigns / Blocks / CampaignGoal / utils.ts
utils.ts
36 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {__} from '@wordpress/i18n';
2 import {getCampaignOptionsWindowData, amountFormatter} from '@givewp/campaigns/utils';
3
4
5 export const getGoalDescription = (goalType: string) => {
6 switch (goalType) {
7 case 'amount':
8 return __('Amount raised', 'give');
9 case 'donations':
10 return __('Number of donations', 'give');
11 case 'donors':
12 return __('Number of donors', 'give');
13 case 'amountFromSubscriptions':
14 return __('Recurring amount raised', 'give');
15 case 'subscriptions':
16 return __('Number of recurring donations', 'give');
17 case 'donorsFromSubscriptions':
18 return __('Number of recurring donors', 'give');
19 }
20 }
21
22
23 export const getGoalFormattedValue = (goalType: string, value: number) => {
24 switch (goalType) {
25 case 'amount':
26 case 'amountFromSubscriptions':
27 const {currency} = getCampaignOptionsWindowData()
28 const currencyFormatter = amountFormatter(currency);
29
30 return currencyFormatter.format(value);
31
32 default:
33 return value;
34 }
35 }
36