Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ia): endpoint updates #1974

Merged
merged 6 commits into from
Feb 10, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/blocks/donate/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ const Edit = ( { attributes, setAttributes, className }: EditProps ) => {
platform: '',
} );

interface AudienceDonations {
donation_data: DonationSettings;
}

useEffect( () => {
apiFetch< DonationSettings >( {
path: '/newspack/v1/wizard/newspack-reader-revenue-wizard/donations',
apiFetch< AudienceDonations >( {
path: '/newspack/v1/wizard/newspack-audience-donations',
} )
.then( ( donationSettings: DonationSettings ) => {
.then( ( { donation_data: donationSettings }: AudienceDonations ) => {
setSettings( {
amounts: donationSettings.amounts,
currencySymbol: donationSettings.currencySymbol,
Expand Down Expand Up @@ -118,7 +122,7 @@ const Edit = ( { attributes, setAttributes, className }: EditProps ) => {
if ( error.length ) {
return (
<Placeholder icon="warning" label={ __( 'Error', 'newspack-blocks' ) } instructions={ error }>
<ExternalLink href="/wp-admin/admin.php?page=newspack-reader-revenue-wizard#/donations">
<ExternalLink href="/wp-admin/admin.php?page=newspack-audience-donations">
{ __( 'Go to donation settings to troubleshoot.', 'newspack-blocks' ) }
miguelpeixe marked this conversation as resolved.
Show resolved Hide resolved
</ExternalLink>
</Placeholder>
Expand All @@ -132,7 +136,7 @@ const Edit = ( { attributes, setAttributes, className }: EditProps ) => {
label={ __( 'The Donate block will not be rendered.', 'newspack-blocks' ) }
instructions={ __( 'The Reader Revenue platform is set to "other".', 'newspack-blocks' ) }
>
<ExternalLink href="/wp-admin/admin.php?page=newspack-reader-revenue-wizard#/donations">
<ExternalLink href="/wp-admin/admin.php?page=newspack-audience-donations">
{ __( 'Go to donation settings to update the platform.', 'newspack-blocks' ) }
miguelpeixe marked this conversation as resolved.
Show resolved Hide resolved
</ExternalLink>
</Placeholder>
Expand Down Expand Up @@ -405,7 +409,7 @@ const Edit = ( { attributes, setAttributes, className }: EditProps ) => {
) }
<br />
<br />
<ExternalLink href="/wp-admin/admin.php?page=newspack-reader-revenue-wizard#/donations">
<ExternalLink href="/wp-admin/admin.php?page=newspack-audience-donations">
{ __( 'Edit donation settings', 'newspack-blocks' ) }
</ExternalLink>
</p>
Expand Down