) {
const blockProps = useBlockProps();
const campaignWindowData = getCampaignOptionsWindowData();
const [showNotification, setShowNotification] = useState(campaignWindowData.admin.showCampaignInteractionNotice);
const {record: campaign, hasResolved, edit, save} = useCampaignEntityRecord(attributes.campaignId);
const Notices = () => {
if (!attributes.campaignId) {
return null;
}
if (campaign.pageId) {
if (!showNotification) {
return null;
}
return (
{
updateUserNoticeOptions('givewp_campaign_interaction_notice').then(() => setShowNotification(false))
}}>
{__('Campaign interaction', 'give ')}
{__('Users will be redirected to campaign page.', 'give')}
)
}
return (
{
e.preventDefault();
const campaignPageResponse = await createCampaignPage(campaign.id)
if (campaignPageResponse) {
edit({...campaign, pageId: campaignPageResponse?.id});
await save();
}
}}
style={styles['link']}
>
{__('Create campaign page.', 'give')}
)
};
return (
{hasResolved && (
<>
setAttributes({campaignId})}
showInspectorControl={true}
inspectorControls={}
>
setAttributes({showImage})}
/>
setAttributes({showDescription})}
/>
setAttributes({showGoal})}
/>
>
)}
)
}