Skip to content

Commit

Permalink
feat: revenue tab
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpeixe committed Nov 26, 2024
1 parent 8a933f1 commit 0a88421
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
4 changes: 4 additions & 0 deletions includes/wizards/audience/class-audience-donations.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function enqueue_scripts_and_styles() {
'newspackAudienceDonations',
[
'can_use_name_your_price' => Donations::can_use_name_your_price(),
'revenue_link' => admin_url( 'admin.php?page=wc-reports' ),
]
);
}
Expand Down Expand Up @@ -236,6 +237,9 @@ public function fetch_all_data() {
$stripe_data = Stripe_Connection::get_stripe_data();

$args = [
'platform_data' => [
'platform' => $platform,
],
'additional_settings' => [
'allow_covering_fees' => get_option( 'newspack_donations_allow_covering_fees', true ),
'allow_covering_fees_default' => get_option( 'newspack_donations_allow_covering_fees_default', false ),
Expand Down
5 changes: 3 additions & 2 deletions src/wizards/audience/views/donations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import { __ } from '@wordpress/i18n';
*/
import { Wizard, Notice, withWizard } from '../../../../components/src';
import Configuration from './configuration';
import Revenue from './revenue';
import { AUDIENCE_DONATIONS_WIZARD_SLUG, NEWSPACK, OTHER } from '../../constants';

const AudienceDonations = () => {
const { platform_data, donation_data } = Wizard.useWizardData( 'audience-donations' );
const { platform_data, donation_data } = Wizard.useWizardData( 'newspack-audience-donations' );
const usedPlatform = platform_data?.platform;
const sections = [
{
Expand All @@ -30,7 +31,7 @@ const AudienceDonations = () => {
{
label: __( 'Revenue', 'newspack-plugin' ),
path: '/revenue',
render: () => null,
render: Revenue,
isHidden: usedPlatform !== NEWSPACK,
},
];
Expand Down
39 changes: 39 additions & 0 deletions src/wizards/audience/views/donations/revenue/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* globals newspackAudienceDonations */
/**
* WordPress dependencies.
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies.
*/
import { Button, Card } from '../../../../../components/src';
import WizardsTab from '../../../../wizards-tab';

/**
* Donation Revenues screen.
*/
const DonationsRevenue = () => (
<WizardsTab title={ __( 'Revenue', 'newspack-plugin' ) }>
<div className="newspack-campaigns-wizard-analytics__wrapper">
<Card isNarrow>
<h2>{ __( 'View Donation Revenue in WooCommerce', 'newspack-plugin' ) }</h2>
<p>
{
__(
'You can view revenue from donations and subscriptions in the WooCommerce plugin.',
'newspack-plugin'
)
}
</p>
<Card buttonsCard noBorder>
<Button isPrimary href={ newspackAudienceDonations.revenue_link }>
{ __( 'See Revenue Data', 'newspack-plugin' ) }
</Button>
</Card>
</Card>
</div>
</WizardsTab>
);

export default DonationsRevenue;

0 comments on commit 0a88421

Please sign in to comment.