import { DonationPlugin , PagarMeCheckout , FinishMessageCustom , FinishDonationMessage , DonationAnalytics , DonationTellAFriend , } from '../bonde-webpage' ; import getConfig from 'next/config' ; import fetch from 'node-fetch' ; import Utils from '../Utils' ; const { publicRuntimeConfig } = getConfig ( ) ; const DonationConnected = ( props ) => < PagarMeCheckout { ... props } asyncFetchDonationsStats = { async ( args ) => ( await fetch ( '/api/data/donations' , { method : 'post' , body : JSON . stringify ( args ) , headers : { 'Content-Type' : 'application/json' } , } ) ) . json ( ) } asyncDonationConvert = { async ( args ) => ( await fetch ( '/api/actions/donation-convert' , { method : 'post' , body : JSON . stringify ( args ) , headers : { 'Content-Type' : 'application/json' } , } ) ) . json ( ) } createTransaction = { async ( args ) => ( await fetch ( '/api/actions/donation' , { method : 'post' , body : JSON . stringify ( args ) , headers : { 'Content-Type' : 'application/json' } , } ) ) . json ( ) } pagarmeKey = { publicRuntimeConfig . pagarmeKey || 'setup env var' } donationComponent = { DonationPlugin } analyticsEvents = { DonationAnalytics } overrides = { { FinishCustomMessage : { component : FinishMessageCustom } , FinishDefaultMessage : { component : DonationTellAFriend , props : { imageUrl : Utils . imageUrl , href : Utils . getSharedPath ( props . mobilization ) , } , } , FinishDonationMessage : { component : FinishDonationMessage , props : { imageUrl : Utils . imageUrl , href : Utils . getSharedPath ( props . mobilization ) , } , } , } } />; export default DonationConnected ;