diff --git a/clients/libs/webpage/src/lib/plugins/donation/analytics.js b/clients/libs/webpage/src/lib/plugins/donation/analytics.js
deleted file mode 100644
index 6ecbcb55ae..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/analytics.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import AnalyticsBase from '../../analytics-base'
-
-const DONATION_STARTED = {
- category: 'Doação',
- action: 'Escolheu Valor'
-}
-
-const DONATION_FINISHED = {
- category: 'Doação',
- action: 'Servidor Recebeu Dados'
-}
-
-class Analytics extends AnalyticsBase {
-
-
- donationSetValue () {
- return this.sendEvent(DONATION_STARTED)
- }
-
- donationFinishRequest (value) {
- return this.sendEvent({ ...DONATION_FINISHED, label: value })
- }
-}
-
-export default new Analytics()
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/form-select.js b/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/form-select.js
deleted file mode 100644
index 85361b850b..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/form-select.js
+++ /dev/null
@@ -1,150 +0,0 @@
-import React from 'react'
-import { FormattedMessage } from 'react-intl'
-import PropTypes from 'prop-types'
-
-const FormSelect = (props) => {
- const {
- widget: { settings },
- mobilization: { header_font },
- onChange,
- value,
- onSubmit
- } = props
-
- const mainColor = (settings && settings.main_color) || '#54d0f6'
-
- const { donation_value1, donation_value2, donation_value3, donation_value4, donation_value5 } = settings
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
-}
-
-FormSelect.propTypes = {
- mobilization: PropTypes.shape({
- header_font: PropTypes.string
- }),
- widget: PropTypes.shape({
- settings: PropTypes.any
- }),
- onChange: PropTypes.func,
- value: PropTypes.string
-}
-
-export default FormSelect
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/index.js b/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/index.js
deleted file mode 100644
index 69624011de..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/index.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import React from 'react'
-import FormSelect from './form-select'
-import PropTypes from 'prop-types'
-import { TellAFriend } from '..';
-import { FormattedMessage } from 'react-intl';
-
-class FinishPostDonation extends React.Component {
- constructor(p) {
- super(p)
- this.state = {
- value: this.props.defaultSelectedValue,
- success: false
- }
-
- this.handleChange = this.handleChange.bind(this)
- }
-
- handleChange(e) {
- const {value} = e.currentTarget
- this.setState({ value: Number(value) })
- }
-
- render() {
- const {
- // Passed Donation to Finish by props
- mobilization,
- widget,
- donationCustomerData,
- // Passed Donation to Finish by state
- defaultSelectedValue,
- onClickDonation,
- finishDonationComponent: FinishDonationComponent,
- imageUrl
- } = this.props
-
- return this.state.success ? (
- }
- imageUrl={this.state.donationValue && imageUrl}
- />
- ) : (
- {
- await onClickDonation(value)
- this.setState({
- success: true,
- donationValue: value
- })
- }}
- />
- )
- }
-}
-
-FinishPostDonation.propTypes = {
- mobilization: PropTypes.object.isRequired,
- widget: PropTypes.object.isRequired.isRequired,
- donationCustomerData: PropTypes.object.isRequired,
- defaultSelectedValue: PropTypes.number.isRequired,
- onClickDonation: PropTypes.func.isRequired,
- finishDonationComponent: PropTypes.func.isRequired,
- imageUrl: PropTypes.string
-}
-
-export default FinishPostDonation
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/index.spec.js b/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/index.spec.js
deleted file mode 100644
index 2f9c1947ca..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/finish-post-donation/index.spec.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import FinishPostDonation from './'
-import { shallow, mount } from 'enzyme'
-import * as React from 'react'
-import { IntlProvider } from 'react-intl'
-import test from 'ava'
-import sinon from 'sinon'
-import FormSelect from './form-select'
-
-import {JSDOM} from 'jsdom'
-const doc = new JSDOM('')
-global.window = doc.window
-global.document = window.document
-
-const finishDonationStub = sinon.fake.returns('oi')
-
-const props = {
- widget: {
- settings: {
- donation_value1: '10',
- donation_value2: '20',
- donation_value3: '30',
- donation_value4: '40',
- donation_value5: '50',
- }
- },
- mobilization: {
- header_font: 'ubuntu'
- },
- defaultSelectedValue: '3',
- onClickDonation: sinon.spy(),
- finishDonationComponent: finishDonationStub
-}
-
-function setupFinishPostDonation() {
- const wrapper = mount(
-
- )
-
- return wrapper
-}
-
-test('FormSelect rendered', t => {
- const wrapper = setupFinishPostDonation()
- t.is(wrapper.find(FormSelect).length, 1)
-})
-
-test('submit buttons are rendered on form-select', t => {
- const wrapper = setupFinishPostDonation()
- t.is(wrapper.find('button').length, 2)
-})
-
-test('default value for select its the same of donation configuration option', t => {
- const wrapper = setupFinishPostDonation()
- t.is(wrapper.find('select[value="3"]').length, 1)
-})
-
-test('selecting an option changes component state', t => {
- const wrapper = setupFinishPostDonation().find(FinishPostDonation)
- wrapper.find('select').invoke('onChange')({currentTarget: {value: '2'}})
- t.is(wrapper.state('value'), 2)
-})
-
-test('donate submit button call onSubmit with default selected value', t => {
- const wrapper = setupFinishPostDonation()
- wrapper.find('#donate-btn').simulate('click')
- t.true(props.onClickDonation.calledWith('3'))
-})
-
-test('donate submit button call onSubmit with undefined value', t => {
- const wrapper = setupFinishPostDonation()
- wrapper.find('#donate-btn').simulate('click')
- t.true(props.onClickDonation.calledWith('3'))
-})
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/index.js b/clients/libs/webpage/src/lib/plugins/donation/components/index.js
deleted file mode 100644
index dbef0dca7e..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export { default as Progress } from './progress'
-export { default as TellAFriend } from './tell-a-friend'
-export { default as FinishPostDonation } from './finish-post-donation'
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/progress.js b/clients/libs/webpage/src/lib/plugins/donation/components/progress.js
deleted file mode 100644
index 229c855a00..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/progress.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import classnames from 'classnames'
-import tinycolor from 'tinycolor2'
-import { numberUtils } from '../utils'
-
-if (require('exenv').canUseDOM) require('./progress.scss')
-
-const colorStrategy = color => tinycolor(color).isDark() ? '#FFFFFF' : '#333333'
-
-const Progress = ({
- className,
- value,
- max,
- valueTopLeft,
- valueTopCenter,
- valueTopRight,
- valueBottomLeft,
- valueBottomCenter,
- valueBottomRight,
- fillColor
-}) => (
-
-
- {valueTopLeft &&
{valueTopLeft}
}
- {valueTopCenter &&
{valueTopCenter}
}
- {valueTopRight &&
{valueTopRight}
}
-
-
-
-
100 ? 100 : value}%`
- }}
- >
- {value > 5 && (
-
- {numberUtils.number(value).split(',')[0]}%
-
- )}
-
-
-
-
- {valueBottomLeft &&
{valueBottomLeft}
}
- {valueBottomCenter &&
{valueBottomCenter}
}
- {valueBottomRight &&
{valueBottomRight}
}
-
-
-)
-
-Progress.propTypes = {
- className: PropTypes.string,
- value: PropTypes.number,
- max: PropTypes.number,
- valueTopLeft: PropTypes.node,
- valueTopRight: PropTypes.node,
- valueTopCenter: PropTypes.node,
- valueBottomLeft: PropTypes.node,
- valueBottomRight: PropTypes.node,
- valueBottomCenter: PropTypes.node,
- fillColor: PropTypes.string
-}
-
-Progress.defaultProps = {
- max: 100,
- value: 0,
- fillColor: 'hsl(171, 100%, 41%)'
-}
-
-export default Progress
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/progress.scss b/clients/libs/webpage/src/lib/plugins/donation/components/progress.scss
deleted file mode 100644
index 6fe11bdce1..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/progress.scss
+++ /dev/null
@@ -1,170 +0,0 @@
-// Colors
-$black: hsl(0, 0%, 4%);
-$black-bis: hsl(0, 0%, 7%);
-$black-ter: hsl(0, 0%, 14%);
-
-$grey-darker: hsl(0, 0%, 21%);
-$grey-dark: hsl(0, 0%, 29%);
-$grey: hsl(0, 0%, 48%);
-$grey-light: hsl(0, 0%, 71%);
-$grey-lighter: hsl(0, 0%, 86%);
-
-$white-ter: hsl(0, 0%, 96%);
-$white-bis: hsl(0, 0%, 98%);
-$white: hsl(0, 0%, 100%);
-
-$orange: hsl(14, 100%, 53%);
-$yellow: hsl(48, 100%, 67%);
-$green: hsl(141, 71%, 48%);
-$turquoise: hsl(171, 100%, 41%);
-$blue: hsl(217, 71%, 53%);
-$purple: hsl(271, 100%, 71%);
-$red: hsl(348, 100%, 61%);
-
-// Primary colors
-$primary: $turquoise;
-
-$info: $blue;
-$success: $green;
-$warning: $yellow;
-$danger: $red;
-
-$light: $white-ter;
-$dark: $grey-darker;
-
-// Invert colors
-$orange-invert: findColorInvert($orange);
-$yellow-invert: findColorInvert($yellow);
-$green-invert: findColorInvert($green);
-$turquoise-invert: findColorInvert($turquoise);
-$blue-invert: findColorInvert($blue);
-$purple-invert: findColorInvert($purple);
-$red-invert: findColorInvert($red);
-
-$primary-invert: $turquoise-invert;
-$info-invert: $blue-invert;
-$success-invert: $green-invert;
-$warning-invert: $yellow-invert;
-$danger-invert: $red-invert;
-$light-invert: $dark;
-$dark-invert: $light;
-
-// Sizes
-$size-1: 3rem;
-$size-2: 2.5rem;
-$size-3: 2rem;
-$size-4: 1.5rem;
-$size-5: 1.25rem;
-$size-6: 1rem;
-$size-7: 0.75rem;
-
-$border: $grey-lighter;
-$text: $grey-dark;
-
-$size-small: $size-7;
-$size-normal: $size-6;
-$size-medium: $size-5;
-$size-large: $size-4;
-
-$progress-bar-background-color: $border;
-$progress-value-background-color: $text;
-
-$colors: (
- "white": ($white, $black),
- "black": ($black, $white),
- "light": ($light, $light-invert),
- "dark": ($dark, $dark-invert),
- "primary": ($primary, $primary-invert),
- "info": ($info, $info-invert),
- "success": ($success, $success-invert),
- "warning": ($warning, $warning-invert),
- "danger": ($danger, $danger-invert)
-);
-
-@mixin block() {
- &:not(:last-child) {
- margin-bottom: 1.5rem
- }
-}
-
-.progress-container {
- color: #666;
- font-size: 1rem;
- line-height: 1rem;
-
- .progress {
- @include block();
- border: none;
- border-radius: 290486px;
- display: block;
- height: $size-normal;
- overflow: hidden;
- padding: 0;
- width: 100%;
- margin: 1rem 0 !important;
- background-color: $progress-bar-background-color;
-
- .progress-value {
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 290486px;
-
- .percentage {
- font-size: .65rem;
- font-weight: bold;
- }
-
- // Colors
- @each $name, $pair in $colors {
- $color: nth($pair, 1);
- &.is-#{$name} { background-color: $color }
- }
- }
- // Sizes
- &.is-small { height: $size-small }
- &.is-medium { height: $size-medium }
- &.is-large { height: $size-large }
- }
-
- .progress-top, .progress-bottom {
- display: flex;
- justify-content: space-between;
- font-size: .8em;
- }
-
- .progress-top > div, .progress-bottom > div {
- flex-basis: 33.33%;
- flex-shrink: 0;
- }
-
- .progress-top-left:only-child,
- .progress-top-center:only-child,
- .progress-top-right:only-child {
- flex-basis: 100%;
- }
-
- .progress-top-left, .progress-bottom-left { text-align: left }
- .progress-top-center, .progress-bottom-center { text-align: center }
- .progress-top-right, .progress-bottom-right { text-align: right }
-
-
- @media screen and (max-width: 831px) {
- .progress { height: 25px }
- .percentage { font-size: 1rem !important }
- .progress-top > div,
- .progress-bottom > div {
- text-align: left;
- margin: .5rem;
- }
- .progress-top { font-size: 1.25rem }
- .progress-bottom {
- font-size: 1.05rem;
- flex-direction: column;
- }
- .progress-bottom-center { order: 1 }
- .progress-bottom-left { order: 2 }
- .progress-bottom-right { order: 3 }
- }
-}
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/components/tell-a-friend.js b/clients/libs/webpage/src/lib/plugins/donation/components/tell-a-friend.js
deleted file mode 100644
index 680385d540..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/components/tell-a-friend.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import { FormattedMessage } from 'react-intl'
-
-import { TellAFriendBase } from '../../../ux'
-
-const DonationTellAFriend = ({ preview, mobilization, widget, ...props }) => {
- return (
-
- }
- {...props}
- />
- )
-}
-
-DonationTellAFriend.propTypes = {
- preview: PropTypes.bool,
- mobilization: PropTypes.object.isRequired,
- widget: PropTypes.object.isRequired
-}
-
-export default DonationTellAFriend
diff --git a/clients/libs/webpage/src/lib/plugins/donation/graphql/queries.js b/clients/libs/webpage/src/lib/plugins/donation/graphql/queries.js
deleted file mode 100644
index dd6250c707..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/graphql/queries.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { gql } from 'react-apollo'
-
-export const fetchDonationGoalStats = gql`
- query fetchDonationGoalStats($widgetId: Int!) {
- data: getWidgetDonationStats(widgetId: $widgetId)
- }
-`
diff --git a/clients/libs/webpage/src/lib/plugins/donation/images/donation-recurring.png b/clients/libs/webpage/src/lib/plugins/donation/images/donation-recurring.png
deleted file mode 100755
index e264ddb608..0000000000
Binary files a/clients/libs/webpage/src/lib/plugins/donation/images/donation-recurring.png and /dev/null differ
diff --git a/clients/libs/webpage/src/lib/plugins/donation/images/donation-unique.png b/clients/libs/webpage/src/lib/plugins/donation/images/donation-unique.png
deleted file mode 100755
index a7263e28da..0000000000
Binary files a/clients/libs/webpage/src/lib/plugins/donation/images/donation-unique.png and /dev/null differ
diff --git a/clients/libs/webpage/src/lib/plugins/donation/images/thin-circular-cross.svg b/clients/libs/webpage/src/lib/plugins/donation/images/thin-circular-cross.svg
deleted file mode 100644
index 49315c1d21..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/images/thin-circular-cross.svg
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
diff --git a/clients/libs/webpage/src/lib/plugins/donation/index.js b/clients/libs/webpage/src/lib/plugins/donation/index.js
deleted file mode 100644
index 4afd5e98a4..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export { default as DonationPlugin } from './plugin.connected'
-export { default as DonationAnalytics } from './analytics'
-export { default as DonationTellAFriend } from './components/tell-a-friend'
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/plugin.connected.js b/clients/libs/webpage/src/lib/plugins/donation/plugin.connected.js
deleted file mode 100644
index 3655f41414..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/plugin.connected.js
+++ /dev/null
@@ -1,123 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import Donation from './plugin'
-
-class DonationConnected extends React.Component {
- constructor (props) {
- super(props)
- this.state = {
- donationCustomerData: undefined
- }
- }
-
- handleTransactionCreate (values) {
- const {
- mobilization,
- widget,
- selectedValue,
- selectedPaymentType,
- storedDonationCustomerData
- } = values
-
- return new Promise((resolve, reject) => {
- const paymentType = widget.settings.payment_type
- const recurringPeriod = widget.settings.recurring_period
- const mainColor = widget.settings.main_color
- ? widget.settings.main_color
- : '#43a2cc'
-
- const checkout = new window.PagarMeCheckout.Checkout({
- encryption_key: this.props.pagarmeKey || 'setup env var',
- success: (data) => {
- data.subscription = paymentType === 'users_choice'
- ? (selectedPaymentType !== 'unique')
- : data.subscription = (paymentType !== 'unique')
-
- data.recurring_period = recurringPeriod
- data.mobilization_id = mobilization.id
- data.widget_id = widget.id
- data.amount = widget.settings['donation_value' + selectedValue] + '00'
-
- return this.props.donationTransactionCreate(data)
- .then((resp) => {
- this.setState({ donationCustomerData: undefined })
- this.props.analyticsEvents.donationFinishRequest()
- return resolve({ donation: resp.data })
- })
- .catch(failure => {
- if (failure.config && failure.config.data) {
- try {
- const failureData = JSON.parse(failure.config.data)
- this.setState({ donationCustomerData: failureData.donation.customer })
- } catch (error) {
- console.error('Customer data is not parsable. Cannot store the customer data.')
- console.error(error)
- }
- } else {
- console.error(failure)
- }
- })
- },
- error: (err) => {
- console.error(err)
- return reject()
- }
- })
-
- let customerData = {}
- if (storedDonationCustomerData) {
- const d = storedDonationCustomerData
-
- // reference: https://docs.pagar.me/v2017-07-17/docs/inserindo-o-formulario
- customerData.customerName = d.name
- customerData.customerDocumentNumber = d.document_number
- customerData.customerEmail = d.email
- customerData.customerPhoneDdd = d.phone.ddd
- customerData.customerPhoneNumber = d.phone.number
- customerData.customerAddressZipcode = d.address.zipcode
- customerData.customerAddressStreet = d.address.street
- customerData.customerAddressStreetNumber = d.address.street_number
- customerData.customerAddressComplementary = d.address.complementary
- customerData.customerAddressNeighborhood = d.address.neighborhood
- customerData.customerAddressCity = d.address.city
- customerData.customerAddressState = d.address.state
- }
-
- const params = {
- createToken: 'false',
- amount: widget.settings['donation_value' + selectedValue] + '00',
- customerData: 'true',
- paymentMethods: widget.settings.payment_methods === 'true' ? 'credit_card,boleto' : 'credit_card',
- uiColor: mainColor,
- paymentButtonText: widget.settings.button_text,
- ...customerData
- }
-
- this.props.analyticsEvents.donationSetValue()
-
- checkout.open(params)
- })
- }
-
- render () {
- return (
-
- )
- }
-}
-
-DonationConnected.propTypes = {
- pagarmeKey: PropTypes.string.isRequired
-}
-
-export default DonationConnected
-
-/* TOOD: script inserted on top level for rendering, but need thing a better solution
-// eslint-disable-next-line
-const pagarmeScript = `(function(i,s,o,g,r,a,m){i['PagarMeCheckoutObject']=r;i[r]=i[r]||function(){(i[].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://assets.pagar.me/checkout/checkout.js','PagarMeCheckout');`
-
-*/
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/plugin.graphql.js b/clients/libs/webpage/src/lib/plugins/donation/plugin.graphql.js
deleted file mode 100644
index 93786ec430..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/plugin.graphql.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import { graphql } from 'react-apollo'
-import * as graphqlQueries from './graphql/queries'
-import DonationPluginConnected from './plugin.connected'
-
-export default graphql(graphqlQueries.fetchDonationGoalStats, {
- name: 'donationGoalStats',
- options: props => ({
- variables: { widgetId: props.widget.id },
- fetchPolicy: 'network-only'
- })
-})
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/plugin.js b/clients/libs/webpage/src/lib/plugins/donation/plugin.js
deleted file mode 100644
index 1f0f175ebc..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/plugin.js
+++ /dev/null
@@ -1,514 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import classnames from 'classnames'
-import { FormattedMessage, intlShape } from 'react-intl'
-import { Progress, TellAFriend } from './components'
-import { numberUtils } from './utils'
-
-if (require('exenv').canUseDOM) require('./plugin.scss')
-
-export const DonationSubmitButton = ({ children, mainColor, onClick }) => (
-
-)
-
-class Donation extends React.Component {
- constructor (props, context) {
- super(props, context)
- this.state = {
- hasMouseOver: false,
- loading: false,
- success: false,
- donation: undefined,
- selected_value: 1,
- selected_payment_type: 'recurring',
- errors: []
- }
- }
-
- componentDidMount () {
- const { widget } = this.props
-
- const defaultDonationValue = (
- widget.settings && widget.settings.default_donation_value
- ? widget.settings.default_donation_value
- : 1
- )
- this.setState({ selected_value: Number(defaultDonationValue) })
- }
-
- componentWillReceiveProps (nextProps) {
- if (this.state.loading) {
- this.setState({ loading: false, success: true })
- }
- }
-
- handleClickSetTypeDonation (paymentType) {
- this.setState({ selected_payment_type: paymentType })
- }
-
- handleClickSetValueDonation (v) {
- this.setState({ selected_value: Number(v) })
- }
-
- handleClickDonate () {
- const { mobilization, widget, donationCustomerData } = this.props
- const {
- selected_value: selectedValue,
- selected_payment_type: selectedPaymentType
- } = this.state
-
- return this.props.handleDonationTransactionCreate({
- mobilization,
- widget,
- selectedValue,
- selectedPaymentType,
- storedDonationCustomerData: donationCustomerData
- }).then(({ donation }) => {
- this.setState({ success: true, donation })
- })
- }
-
- renderProgressBar (mainColor) {
- let goalDateRemaining
- const { donationGoalStats, widget: { settings, goal } } = this.props
-
- const goalStats = (
- !donationGoalStats ||
- !donationGoalStats.data ||
- donationGoalStats.loading
- )
- ? undefined
- : JSON.parse(donationGoalStats.data)
-
- if (settings && settings.goal_date_limit) {
- const now = new Date()
- const [day, month, year] = settings.goal_date_limit.split('/')
- const goalDate = new Date(`${year}-${month}-${day}`)
- goalDateRemaining = Math.ceil((goalDate - now) / (1000 * 60 * 60 * 24))
- }
-
- const props = {
- value: 0,
- valueTopLeft: '',
- valueTopRight: '',
- valueBottomLeft: '',
- valueBottomRight: ''
- }
-
- if (goalStats) {
- if (goalStats.pledged) {
- props.valueTopCenter = (
-
-
- {numberUtils.currencyInt(goalStats.pledged)}
-
-
-
-
-
- )
- }
- if (goalStats.progress) {
- props.value = goalStats.progress
- }
- if (goalStats.total_donations) {
- props.valueBottomLeft = (
-
-
-
- )
- }
- }
-
- if (goal) {
- props.valueBottomCenter = (
-
-
-
-
- {' '}{numberUtils.currencyInt(goal)}
-
- )
- }
- if (goalDateRemaining !== undefined) {
- if (goalDateRemaining === 0) {
- props.valueBottomRight = (
-
- )
- } else if (goalDateRemaining > 0 && goalDateRemaining < 7) {
- props.valueBottomRight = (
-
- )
- } else if (goalDateRemaining === 7) {
- props.valueBottomRight = (
-
- )
- } else if (goalDateRemaining > 0) {
- props.valueBottomRight = (
-
- )
- }
-
- props.valueBottomRight = (
-
- {props.valueBottomRight}
-
- )
- }
-
- return (goal || goalDateRemaining !== undefined) && (
-
- )
- }
-
- renderButton () {
- const {
- widget: { settings },
- mobilization: { header_font: headerFont },
- intl
- } = this.props
-
- const {
- selected_value: selectedValue,
- selected_payment_type: selectedPaymentType
- } = this.state
-
- const buttonText = (settings && settings.button_text) || (
-
- )
- const titleText = (settings && (settings.call_to_action || settings.title_text)) || (
-
- )
-
- const donationValue1 = (settings && settings.donation_value1) || 0
- const donationValue2 = (settings && settings.donation_value2) || 0
- const donationValue3 = (settings && settings.donation_value3) || 0
- const donationValue4 = (settings && settings.donation_value4) || 0
- const donationValue5 = (settings && settings.donation_value5) || 0
- const mainColor = (settings && settings.main_color) || '#54d0f6'
-
- const paymentType = (settings && settings.payment_type) || 'unique'
- const recurringPeriod = (settings && settings.recurring_period) || 30
-
- const isUniquePayment = paymentType === 'unique' || selectedPaymentType === 'unique'
- const periodLabelOptions = {
- 30: intl.formatMessage({
- id: 'widgets.components--donation.period-label-options.month',
- defaultMessage: 'mês'
- }),
- 180: intl.formatMessage({
- id: 'widgets.components--donation.period-label-options.halfyear',
- defaultMessage: 'semestre'
- }),
- 365: intl.formatMessage({
- id: 'widgets.components--donation.period-label-options.year',
- defaultMessage: 'ano'
- })
- }
- const periodLabelCurrent = periodLabelOptions[recurringPeriod]
- const periodLabel = isUniquePayment ? '' : periodLabelCurrent
-
- return (
-
-
- {titleText}
-
-
- {paymentType === 'users_choice' ?
-
-
-
: ''}
- {donationValue1 <= 0 ? null : (
-
- )}
- {donationValue2 <= 0 ? null : (
-
- )}
- {donationValue3 <= 0 ? null : (
-
- )}
- {donationValue4 <= 0 ? null : (
-
- )}
- {donationValue5 <= 0 ? null : (
-
- )}
-
-
- {buttonText}
-
-
-
-
- {this.renderProgressBar(mainColor)}
-
-
- )
- }
-
- convertHex (hex, opacity) {
- hex = hex.replace('#', '')
- let r = parseInt(hex.substring(0, 2), 16)
- let g = parseInt(hex.substring(2, 4), 16)
- let b = parseInt(hex.substring(4, 6), 16)
-
- let result = 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')'
- return result
- }
-
- renderForm () {
- return (
-
- {this.renderButton()}
-
- )
- }
-
- renderThankyouText () {
- const { mobilization, widget, overrides } = this.props
- const { settings: { finish_message_type: finishMessageType } } = widget
-
- const {
- FinishCustomMessage: { component: FinishCustomMessage, props: customProps },
- FinishDefaultMessage: { component: FinishDefaultMessage, props: defaultProps },
- FinishDonationMessage: { component: FinishDonationMessage, props: donationProps }
- } = overrides
-
- if (finishMessageType === 'custom') {
- return
- }
- if (finishMessageType === 'donation-recurrent' && this.state.donation.payment_method !== 'boleto') {
- return (
- {
- if (value) {
- return this.props.handleDonationTransactionConvert({
- donation_id: this.state.donation.id,
- amount: widget.settings['donation_value' + value] + '00',
- })
- }
- }}
- />
- )
- }
- return
- }
-
- renderReattemptMessage () {
- const { widget: { settings } } = this.props
- const mainColor = (settings && settings.main_color) || '#54d0f6'
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
- }
-
- renderContentStrategy () {
- if (this.props.donationCustomerData) {
- return this.renderReattemptMessage()
- }
- if (this.state.success) {
- return this.renderThankyouText()
- }
- return this.renderForm()
- }
-
- render () {
- return (
-
- {this.renderContentStrategy()}
-
- )
- }
-}
-
-const { any, bool, func, object, shape } = PropTypes
-
-Donation.propTypes = {
- mobilization: object.isRequired,
- widget: object.isRequired,
- hasNewField: bool,
- handleDonationTransactionCreate: func,
- intl: intlShape,
- // Overrides componente of success action
- overrides: shape({
- FinishCustomMessage: shape({
- component: any,
- props: object
- }).isRequired,
- FinishDefaultMessage: shape({
- component: any,
- props: object
- }).isRequired,
- FinishPostDonation: shape({
- component: any,
- props: object
- }).isRequired,
- }).isRequired
-}
-
-Donation.defaultProps = {
- overrides: {
- FinishCustomMessage: { props: {} },
- FinishDefaultMessage: { props: {} }
- }
-}
-
-export default Donation
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/plugin.scss b/clients/libs/webpage/src/lib/plugins/donation/plugin.scss
deleted file mode 100644
index de4b16ad44..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/plugin.scss
+++ /dev/null
@@ -1,69 +0,0 @@
-.widget .donation {
- a {
- color: #b0b0b0;
-
- &:hover { text-decoration: none; }
- &.btn { color: #fff; }
- }
-
- .error-icon {
- -webkit-mask-image: url('./images/thin-circular-cross.svg');
- mask-image: url('./images/thin-circular-cross.svg');
- -webkit-mask-size: 150px;
- mask-size: 150px;
- width: 150px;
- height: 150px;
- }
-
- .icon-payment-recurring,
- .icon-payment-unique {
- background: 50% 50% url('./images/donation-recurring.png') transparent no-repeat;
- background-size: contain;
- width: 2.2rem;
- height: 2.2rem;
- display: inline-block;
- filter: alpha(opacity=50);
- filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.5);
- opacity: .40;
- margin: 0 auto 1rem;
- display: block;
- }
- .icon-payment-unique {
- background-image: url('./images/donation-unique.png');
- }
-
-
- .payment-type {
- font-size: .9rem;
- text-decoration: none;
- border: none;
- background: inherit;
- color: #b0b0b0;
- cursor: pointer;
-
- span {
- margin-top: .7em;
- vertical-align: top;
- }
- span,img {
- display: inline-block;
- }
-
- &.active {
- .icon-payment-recurring,
- .icon-payment-unique {
- opacity: .8;
- }
- }
- }
-
- .value-option {
- color: #b0b0b0;
- border-radius: .3rem;
- box-sizing: border-box;
- border-width: .3rem;
- border-style: solid;
- border-color: #fff;
- cursor: pointer;
- }
-}
diff --git a/clients/libs/webpage/src/lib/plugins/donation/plugin.spec.js b/clients/libs/webpage/src/lib/plugins/donation/plugin.spec.js
deleted file mode 100644
index 68563c9f36..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/plugin.spec.js
+++ /dev/null
@@ -1,163 +0,0 @@
-import * as React from 'react'
-import test from 'ava'
-import sinon from 'sinon'
-import { shallow } from 'enzyme'
-import DonationPlugin, { DonationSubmitButton } from './plugin'
-
-let plugin
-
-test.beforeEach((t) => {
- t.context.props = {
- widget: { settings: { donation_value1: 10 } },
- mobilization: {},
- intl: { formatMessage: (key) => `{${key}}` },
- handleDonationTransactionCreate: () => new Promise((res, rej) => {
- return res({ donation: {} })
- }),
- overrides: {
- FinishCustomMessage: { component: () => },
- FinishDefaultMessage: { component: () => },
- FinishDonationMessage: { component: () => }
- }
- }
- t.context.plugin = shallow()
-})
-
-test('should be render DonationPlugin its ok', t => {
- const { plugin } = t.context
-
- t.true(plugin.hasClass('widget'))
-})
-
-test('change state to success when resolve handleDonationTransactionCreate', t => {
- const { plugin } = t.context
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- t.is(plugin.state('success'), true)
- })
-})
-
-test('render FinishDonationMessage.component when pos action is donation-recurrent', t => {
- const { plugin, props: { overrides: { FinishDonationMessage } } } = t.context
- // pos action is donation-recurrent
- const widget = { id: 1, settings: { finish_message_type: 'donation-recurrent' }}
- plugin.setProps({ widget })
- // simulate donation click button
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- t.is(plugin.find(FinishDonationMessage.component).length, 1)
- })
-})
-
-test('render FinishDefaultMessage.component when pos action is share', t => {
- const { plugin, props: { overrides: { FinishDefaultMessage } } } = t.context
- // pos action is share
- const widget = { id: 1, settings: { finish_message_type: 'share' }}
- plugin.setProps({ widget })
- // simulate donation click button
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- t.is(plugin.find(FinishDefaultMessage.component).length, 1)
- })
-})
-
-test('render FinishCustomMessage.component when pos action is custom', t => {
- const { plugin, props: { overrides: { FinishCustomMessage } } } = t.context
- // pos action is custom
- const widget = { id: 1, settings: { finish_message_type: 'custom' }}
- plugin.setProps({ widget })
- // simulate donation click button
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- t.is(plugin.find(FinishCustomMessage.component).length, 1)
- })
-})
-
-test('pass extra props when FinishDonationMessage is rendered', t => {
- const {
- plugin,
- props: {
- overrides: {
- FinishDonationMessage,
- FinishDefaultMessage
- }
- }
- } = t.context
- const handleDonationTransactionCreate = () => new Promise((res, rej) => {
- return res({ donation })
- })
- const donation = { id: 10, payment_method: 'cartao-credito' }
- const widget = { id: 1, settings: { finish_message_type: 'donation-recurrent' }}
- plugin.setProps({
- widget,
- handleDonationTransactionCreate
- })
-
- // simulate donation click button
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- const donationProps = plugin.find(FinishDonationMessage.component).props()
-
- t.is(donationProps.defaultSelectedValue, plugin.state('selected_value'))
- t.is(donationProps.handleDonationTransactionCreate, handleDonationTransactionCreate)
- t.is(donationProps.finishDonationComponent, FinishDonationMessage.component)
- })
-})
-
-test('call handleDonationTransactionConvert when confirm donation-recurrent', t => {
- const {
- plugin,
- props: {
- overrides: {
- FinishDonationMessage
- }
- }
- } = t.context
- const selectedValue = 1
- const donation = { id: 10, payment_method: 'cartao-credito' }
- const widget = { id: 1, settings: { finish_message_type: 'donation-recurrent', donation_value_1: '10' }}
- const handleDonationTransactionConvert = sinon.fake()
-
- plugin.setProps({
- widget,
- handleDonationTransactionConvert,
- handleDonationTransactionCreate: () => new Promise((res, rej) => {
- return res({ donation })
- })
- })
-
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- const donationProps = plugin.find(FinishDonationMessage.component).props()
- // const donationState = plugin.state()
-
- donationProps.onClickDonation(selectedValue)
- t.true(handleDonationTransactionConvert.calledWith({
- amount: widget.settings['donation_value' + selectedValue] + '00',
- donation_id: donation.id
- }))
- })
-})
-
-
-test('should render the default post-action when payment is not made by credit card', t => {
- const {
- plugin,
- props: {
- overrides: {
- FinishDefaultMessage
- }
- }
- } = t.context
- const selectedValue = 1
- const donation = { id: 10, payment_method: 'boleto' }
- const widget = { id: 1, settings: { finish_message_type: 'donation-recurrent', donation_value_1: '10' }}
- const handleDonationTransactionConvert = sinon.fake()
-
- plugin.setProps({
- widget,
- donation,
- handleDonationTransactionConvert,
- handleDonationTransactionCreate: () => new Promise((res, rej) => {
- return res({ donation })
- })
- })
-
- return plugin.find(DonationSubmitButton).invoke('onClick')().then(() => {
- t.is(plugin.find(FinishDefaultMessage.component).length, 1)
- })
-})
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/donation-transaction-convert.js b/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/donation-transaction-convert.js
deleted file mode 100644
index 995ac13037..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/donation-transaction-convert.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const donationTransactionConvert = params => (dispatch, getState, { api, intl }) => {
- const endpoint = `/convert-donation`
- return api.get(endpoint, { params })
-}
-
-export default donationTransactionConvert
diff --git a/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/donation-transaction-create.js b/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/donation-transaction-create.js
deleted file mode 100644
index b72a47a134..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/donation-transaction-create.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const donationTransactionCreate = params => (dispatch, getState, { api, intl }) => {
- const endpoint = `/mobilizations/${params.mobilization_id}/donations`
- const body = { donation: genRequestPayload(params) }
-
- return api.post(endpoint, body)
-}
-
-export default donationTransactionCreate
-
-const genRequestPayload = params => ({
- widget_id: params.widget_id,
- card_hash: params.card_hash,
- payment_method: params.payment_method,
- amount: params.amount,
- customer: params.customer,
- subscription: params.subscription,
- period: params.recurring_period
-})
diff --git a/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/index.js b/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/index.js
deleted file mode 100644
index 1b218beeeb..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/redux/action-creators/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-export { default as donationTransactionCreate } from './donation-transaction-create'
-export { default as donationTransactionConvert } from './donation-transaction-convert'
\ No newline at end of file
diff --git a/clients/libs/webpage/src/lib/plugins/donation/utils.js b/clients/libs/webpage/src/lib/plugins/donation/utils.js
deleted file mode 100644
index 0dfb2066cd..0000000000
--- a/clients/libs/webpage/src/lib/plugins/donation/utils.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import format from 'format-number'
-
-//
-// Options
-//
-const numberOptions = { integerSeparator: '.', decimal: ',' }
-const currencyOptions = { ...numberOptions, prefix: 'R$ ', padRight: 2, truncate: 2 }
-const currencyIntOptions = { ...currencyOptions, padRight: 0, truncate: 0 }
-const floatOptions = { integerSeparator: '', decimal: '.', padRight: 2 }
-const integerOptions = { integerSeparator: '', truncate: 0 }
-
-//
-// Helpers
-//
-const currency = format(currencyOptions)
-const currencyInt = format(currencyIntOptions)
-const number = format(numberOptions)
-const float = format(floatOptions)
-const integer = format(integerOptions)
-
-export const numberUtils = { currency, currencyInt, number, float, integer }
\ No newline at end of file
diff --git a/clients/packages/webpage-client/src/bonde-webpage/components/ux/PluggableWidget/PluggableWidget.tsx b/clients/packages/webpage-client/src/bonde-webpage/components/ux/PluggableWidget/PluggableWidget.tsx
index 10b4581007..c73bec4fa0 100644
--- a/clients/packages/webpage-client/src/bonde-webpage/components/ux/PluggableWidget/PluggableWidget.tsx
+++ b/clients/packages/webpage-client/src/bonde-webpage/components/ux/PluggableWidget/PluggableWidget.tsx
@@ -4,7 +4,6 @@ import Overlay from './Overlay';
import FormPlugin from './../../../../components/FormConnected';
import PressureEmailPlugin from './../../../../components/PressureEmailConnected';
import PlipPlugin from './../../../../components/PlipConnected';
-import DonationConnected from './../../../../components/DonationConnected';
import PhoneWidgetConnected from '../../../../components/PhoneWidgetConnected';
import {
@@ -36,7 +35,7 @@ const PluggableWidget = React.memo((props: any) => {
},
{
kind: 'donation',
- component: DonationConnected
+ component: () => <>>,
},
{
kind: 'pressure',
diff --git a/clients/packages/webpage-client/src/bonde-webpage/index.tsx b/clients/packages/webpage-client/src/bonde-webpage/index.tsx
index da09087fca..55f4aa25da 100644
--- a/clients/packages/webpage-client/src/bonde-webpage/index.tsx
+++ b/clients/packages/webpage-client/src/bonde-webpage/index.tsx
@@ -41,11 +41,4 @@ export { default as PressureAnalytics } from './plugins/Pressure/Analytics';
export { default as PressureTellAFriend } from './plugins/Pressure/components/TellAFriend';
export { default as asyncPressureCreate } from './redux-mob/action-creators/FillWidget';
-/* DonationPlugin */
-export { default as DonationPlugin } from './plugins/Donation';
-export { default as DonationTellAFriend } from './plugins/Donation/TellAFriend';
-export { default as PagarMeCheckout } from './plugins/Donation/PagarMeCheckout';
-export { default as FinishDonationMessage } from './plugins/Donation/FinishDonationMessage';
-export { default as DonationAnalytics } from './plugins/Donation/Analytics';
-
export * from './components'
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Analytics.ts b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Analytics.ts
deleted file mode 100644
index 7476fc8853..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Analytics.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import sendEvent from '../../AnalyticsBase';
-
-const DONATION_STARTED = {
- category: 'Doação',
- action: 'Escolheu Valor',
-};
-
-const DONATION_FINISHED = {
- category: 'Doação',
- action: 'Servidor Recebeu Dados',
-};
-
-const donationSetValue = () => sendEvent(DONATION_STARTED);
-const donationFinishRequest = (value: string) =>
- sendEvent({ ...DONATION_FINISHED, label: value, value });
-
-const Analytics = {
- donationSetValue,
- donationFinishRequest,
-};
-
-export default Analytics;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/IconCopy.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/IconCopy.tsx
deleted file mode 100644
index 5f0b3ef11a..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/IconCopy.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react';
-
-function Icon() {
- return (
-
- );
-}
-
-export default Icon;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/IconEye.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/IconEye.tsx
deleted file mode 100644
index 42183b6cf6..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/IconEye.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from 'react';
-
-function Icon() {
- return (
-
- );
-}
-
-export default Icon;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/index.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/index.tsx
deleted file mode 100644
index 5958391224..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/Boleto/index.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import React from 'react';
-import styled from '@emotion/styled';
-import copy from 'clipboard-copy';
-import TellAFriendBase from '../../../components/ux/TellAFriendBase';
-import IconCopy from './IconCopy';
-import IconEye from './IconEye';
-
-const Code = styled.code`
- padding: 16px 35px;
- background: #eee;
- color: #424242;
-`;
-
-type ButtonProps = {
- flat?: boolean;
-};
-
-const Button = styled.button`
- border-radius: 4px;
- border: 2px solid #ee0099;
- box-sizing: border-box;
- padding: 26px;
- cursor: pointer;
- text-weight: bold;
- text-transform: uppercase;
-
- background: ${props => (props.flat ? 'none' : '#EE0099')};
- color: ${props => (props.flat ? '#EE0099' : '#fff')};
-
- & > svg {
- margin: 0 11px -6px 0;
- }
-`;
-
-const Container = styled.div`
- display: flex;
- flex-direction: column;
- font-family: 'Source Sans Pro', 'Proxima Nova', sans-serif;
- font-size: 18px;
-
- border-bottom: 1px solid #eeeeee;
-
- & > * {
- margin-bottom: 21px;
- }
-`;
-
-const Boleto = ({ donation, ...props }: any) => {
- const { boleto_barcode, boleto_url } = donation.gateway_data || {
- boleto_barcode: '23791.22928 60005.819721 18000.046906 6 83460000000500',
- boleto_url: 'http://localhost/boleto',
- };
-
- return (
- (
-
- {boleto_barcode}
-
-
-
- )}
- />
- );
-};
-
-export default Boleto;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationButton.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationButton.tsx
deleted file mode 100644
index 2810d93fee..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationButton.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import React from 'react';
-import styled from '@emotion/styled';
-
-const rgba = (color: string, alpha: number) => {
- const value = color.replace('#', '');
- const r = parseInt(value.substring(0, 2), 16);
- const g = parseInt(value.substring(2, 4), 16);
- const b = parseInt(value.substring(4, 6), 16);
-
- return 'rgba(' + r + ',' + g + ',' + b + ',' + alpha / 100 + ')';
-};
-
-type DonationButtonStyledProps = {
- mainColor: string;
- active: boolean;
-};
-
-const DonationButtonStyled = styled.button`
- border-radius: 0.3rem;
- box-sizing: border-box;
- border-width: 0.3rem;
- border-style: solid;
- border-color: #fff;
- cursor: pointer;
- width: 100%;
- font-weight: bold;
- opacity: 0.8;
- padding: 0.5rem 0;
- margin-bottom: 0.5rem;
- color: #b0b0b0;
- background: rgba(0, 0, 0, 0.0625);
-
- &:focus {
- outline: none;
- }
- &:hover {
- opacity: 1;
- }
-
- ${props =>
- props.active &&
- `
- background-color: ${rgba(props.mainColor, 35)};
- color: ${props.mainColor};
- `}
-`;
-
-type Props = {
- active: boolean;
- value: string | number;
- label: string;
- mainColor: string;
- // recurring | unique
- paymentType: string;
- onClick: any;
-};
-
-const DonationButton: React.FC = ({
- active,
- label,
- mainColor,
- onClick,
- value,
- paymentType,
-}) => (
-
- {'R$ ' + value + (paymentType === 'recurring' ? ' /' : '') + label}
-
-);
-
-DonationButton.defaultProps = {
- active: false,
-};
-
-export default DonationButton;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationForm.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationForm.tsx
deleted file mode 100644
index e4ff1e3ce7..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationForm.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import React from 'react';
-import styled from '@emotion/styled';
-import LGPD from '../../../components/ux/LGPD';
-
-type DonationFormStylesProps = {
- mainColor: string;
-};
-
-const DonationFormStyles = styled.div`
- .donation-form {
- position: relative;
- padding: 2rem;
- }
-
- .btn-submit {
- width: 100%;
- padding: 1rem;
- color: #fff;
- text-transform: uppercase;
- background-color: ${props => props.mainColor};
- font-weight: bold;
- border: none;
- border-radius: 3px;
- margin-top: 0.5rem;
- cursor: pointer;
-
- &:focus {
- outline: none;
- }
- }
-`;
-
-type Props = {
- title: string;
- headerFont: string;
- mainColor: string;
- buttonText: string;
- onClickDonate: any;
- loading: boolean;
-};
-
-const DonationForm: React.FC = ({
- children,
- title,
- headerFont,
- mainColor,
- buttonText,
- onClickDonate,
- loading,
-}) => (
-
- {title}
-
- {children}
-
-
-
-
-);
-
-export default DonationForm;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationStats.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationStats.tsx
deleted file mode 100644
index f3f154aa5e..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/DonationStats.tsx
+++ /dev/null
@@ -1,173 +0,0 @@
-import React from 'react';
-import styled from '@emotion/styled';
-
-type CurrencyProps = {
- mainColor: string;
-};
-
-const Currency = styled.div`
- font-size: 2.5em;
- line-height: 1em;
- font-weight: bold;
- text-align: center;
-
- span:first-child {
- color: rgb(102, 102, 102);
- color: ${props => props.mainColor};
- }
- span:last-child {
- color: #666;
- text-transform: uppercase;
- margin: 0.4rem 0 0;
- display: block;
- font-size: 0.8rem;
- line-height: 1rem;
- }
-`;
-
-type DonationStatsStylesProps = {
- mainColor: string;
-};
-
-const DonationStatsStyles = styled.div`
- box-shadow: #e3e3e3 0px 15px 18px -10px inset;
- padding: 2rem;
-
- .footer-stats {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
-
- span {
- font-size: 0.8em;
- color: #666;
- line-height: 1rem;
- }
- span:last-child {
- color: ${props => props.mainColor};
- }
- }
-`;
-
-const Bar = styled.div`
- border: none;
- border-radius: 290486px;
- display: block;
- height: 1rem;
- overflow: hidden;
- padding: 0;
- width: 100%;
- margin: 1rem 0 !important;
- background-color: #dbdbdb;
-`;
-
-type ProgressProps = {
- mainColor: string;
- value: number;
-};
-
-const Progress = styled.div`
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 290486px;
- font-size: 0.65rem;
- font-weight: bold;
- color: #fff;
-
- width: ${props => (props.value > 100 ? 100 : props.value)}%;
- background-color: ${props => props.mainColor};
-`;
-
-type Props = {
- mainColor: string;
- currencyLabel?: string;
- donationsLabel?: any;
- daysLabel?: any;
- goalLabel?: string;
- data?: any;
- goalDateLimit?: string;
-};
-
-const currencyInt = (value: number): string => {
- return new Intl.NumberFormat('pt-BR').format(value);
-};
-
-type GoalDateRemainingProps = {
- dateLimit: string;
- daysLabel: any;
-};
-
-const GoalDateRemaining = ({
- dateLimit,
- daysLabel,
-}: GoalDateRemainingProps) => {
- const now = new Date().getTime();
- const [day, month, year] = dateLimit.split('/');
- const limit = new Date(`${year}-${month}-${day}`).getTime();
- const total = Math.ceil((limit - now) / (1000 * 60 * 60 * 24));
-
- return {daysLabel(total)};
-};
-
-const DonationStats: React.FC = ({
- data: stats,
- mainColor,
- currencyLabel,
- donationsLabel,
- goalLabel,
- goalDateLimit,
- daysLabel,
-}) => {
- if (stats.goal && parseInt(stats.goal) === 1) {
- return (
-
- {`R$ ${currencyInt(stats.pledged)}`}
- {currencyLabel}
-
- );
- } else if (stats.goal) {
- return (
-
- {`R$ ${currencyInt(stats.pledged)}`}
- {currencyLabel}
-
-
-
-
-
- {donationsLabel && (
- {`${stats.total_donations} ${donationsLabel(
- stats.total_donations
- )}`}
- )}
- {goalLabel && {`${goalLabel} ${currencyInt(stats.goal)}`}}
- {goalDateLimit && daysLabel && (
-
- )}
-
- );
- }
-
- return null;
-};
-
-DonationStats.defaultProps = {
- mainColor: 'red',
- currencyLabel: 'arrecadados',
- goalLabel: 'Meta:',
- donationsLabel: (total: number) => (total > 1 ? 'apoios' : 'apoio'),
- daysLabel: total => {
- if (total === 0) return 'último dia!';
- else if (total > 0 && total < 7) return 'últimos dias!';
- else if (total === 7) return 'última semana';
- else return `faltam ${total} dias`;
- },
- data:
- '{"pledged":20345,"widget_id":8175,"goal":5000,"progress":406.9,"total_donations":572,"total_donators":63}',
-};
-
-export default DonationStats;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/FetchDonationStats.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/FetchDonationStats.tsx
deleted file mode 100644
index 9dc485d9d9..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/FetchDonationStats.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import React, { useState, useEffect } from 'react';
-// import gql from 'graphql-tag';
-import DonationStats from './DonationStats';
-
-// const query = gql`
-// query fetchDonationGoalStats($widgetId: Int!) {
-// stats: getWidgetDonationStats(widgetId: $widgetId)
-// }
-// `;
-
-type Props = {
- // Function created with createApolloFetch
- // https://www.apollographql.com/blog/4-simple-ways-to-call-a-graphql-api-a6807bcdb355
- asyncFetchDonationsStats: any;
- widgetId: number;
- mainColor: string;
- goalDateLimit?: string;
-};
-
-const FetchDonationStats = ({
- asyncFetchDonationsStats,
- widgetId,
- mainColor,
- goalDateLimit,
-}: Props) => {
- const [fetching, setFetching] = useState(true);
- const [data, setData] = useState();
-
- useEffect(() => {
- asyncFetchDonationsStats({ widget_id: widgetId })
- .then(({ data }: any) => {
- setData(data.stats);
- setFetching(false);
- })
- .catch((err: any) => {
- console.error('FetchDonationStats: ', err);
- });
- }, [asyncFetchDonationsStats, widgetId]);
-
- if (fetching) return ;
- else
- return (
-
- );
-};
-
-export default FetchDonationStats;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/RecurringIcon.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/RecurringIcon.tsx
deleted file mode 100644
index 8f21b8d8c4..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/RecurringIcon.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-
-const RecurringIcon = () => {
- return (
-
- );
-};
-
-export default RecurringIcon;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/SelectPaymentType.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/SelectPaymentType.tsx
deleted file mode 100644
index d2c6064eb5..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/SelectPaymentType.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import React from 'react';
-import UniqueIcon from './UniqueIcon';
-import RecurringIcon from './RecurringIcon';
-import styled from '@emotion/styled';
-
-type SelectStyledProps = {
- mainColor: string;
-};
-
-const SelectPaymentTypeStyled = styled.div`
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- margin-bottom: 1rem;
-
- button {
- display: flex;
- flex-direction: column;
- align-items: center;
-
- font-size: 0.9rem;
- text-decoration: none;
- border: none;
- background: inherit;
- cursor: pointer;
- font-weight: 700;
- padding: 0.5rem 0;
- opacity: 0.3;
-
- &:focus {
- outline: none;
- }
- &.active {
- opacity: 1;
- color: ${props => props.mainColor};
- }
-
- svg {
- width: 35px;
- height: 35px;
- margin: 0 auto 1rem;
- }
- }
-
- &:after,
- &:before {
- content: ' ';
- display: table;
- }
-`;
-
-type Props = {
- mainColor: string;
- selected: string;
- onSelect: (paymentType: string) => void;
- uniqueLabel: string;
- recurringLabel: string;
-};
-
-const SelectPaymentType: React.FC = ({
- mainColor,
- selected,
- onSelect,
- uniqueLabel,
- recurringLabel,
-}) => (
-
-
-
-
-);
-
-export default SelectPaymentType;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/UniqueIcon.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/UniqueIcon.tsx
deleted file mode 100644
index 4d6d8bbb85..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/UniqueIcon.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-
-const UniqueIcon = () => {
- return (
-
- );
-};
-
-export default UniqueIcon;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/index.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/index.tsx
deleted file mode 100644
index c7c2845686..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/DonationFormCreate/index.tsx
+++ /dev/null
@@ -1,131 +0,0 @@
-import React from 'react';
-import DonationForm from './DonationForm';
-import SelectPaymentType from './SelectPaymentType';
-import DonationButton from './DonationButton';
-import FetchDonationStats from './FetchDonationStats';
-
-type Props = {
- asyncFetchDonationsStats?: any;
- widget: any;
- headerFont: string;
- mainColor: string;
- titleText: string;
- buttonText: string;
- loading: boolean;
- handleClickDonate: any;
- selectedValue: number;
- setSelectedValue: any;
- selectedPaymentType: string;
- setSelectedPaymentType: any;
- recurringLabel: string;
-};
-
-// eslint-disable-next-line react/display-name
-export default ({
- asyncFetchDonationsStats,
- widget,
- headerFont,
- mainColor,
- titleText,
- buttonText,
- loading,
- selectedValue,
- setSelectedValue,
- selectedPaymentType,
- setSelectedPaymentType,
- handleClickDonate,
- recurringLabel,
-}: Props) => {
- const {
- settings: {
- goal_date_limit: goalDateLimit,
- payment_type: paymentType,
- donation_value1: donationValue1,
- donation_value2: donationValue2,
- donation_value3: donationValue3,
- donation_value4: donationValue4,
- donation_value5: donationValue5,
- },
- } = widget;
-
- return (
- <>
-
- {paymentType === 'users_choice' && (
-
- )}
- {donationValue1 && (
- setSelectedValue(1)}
- />
- )}
- {donationValue2 && (
- setSelectedValue(2)}
- />
- )}
- {donationValue3 && (
- setSelectedValue(3)}
- />
- )}
- {donationValue4 && (
- setSelectedValue(4)}
- />
- )}
- {donationValue5 && (
- setSelectedValue(5)}
- />
- )}
-
- {asyncFetchDonationsStats && goalDateLimit && (
-
- )}
- >
- );
-};
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/FinishDonationMessage/FormSelect.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/FinishDonationMessage/FormSelect.tsx
deleted file mode 100644
index 7d3a303241..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/FinishDonationMessage/FormSelect.tsx
+++ /dev/null
@@ -1,162 +0,0 @@
-import React from 'react';
-import styled from '@emotion/styled';
-
-type StylesProps = {
- headerFont: string;
- mainColor?: string;
-};
-
-const Styles = styled.div`
- background-color: #fff;
- text-align: center;
-
- h2 {
- font-family: ${props => props.headerFont};
- font-weight: bold;
- background-color: ${props => props.mainColor};
- margin: 0;
- padding: 1rem;
- border-radius: 3px 3px 0 0;
- }
-
- .content {
- padding: 0 2rem 2rem;
- color: #000 !important;
-
- .description {
- padding: 1rem;
- }
- .text {
- font-size: 14px;
- margin-bottom: 1rem;
- color: gray !important;
- }
- }
-
- select {
- box-sizing: border-box;
- height: auto;
- background-color: #fff;
- -webkit-appearance: none;
- -moz-appearance: none;
- appearance: none;
- display: block;
- width: 100%;
- padding: 0.5rem;
- margin-bottom: 1rem;
- border: 1px solid #ccc;
- border-radius: 3px;
- }
-
- &:after,
- &:before {
- content: ' ';
- display: table;
- }
- &:after {
- clear: both;
- }
-`;
-
-const FormSelect = (props: any) => {
- const {
- widget: { settings },
- mobilization: { header_font },
- onChange,
- value,
- onSubmit,
- } = props;
-
- const mainColor = (settings && settings.main_color) || '#54d0f6';
-
- const {
- donation_value1,
- donation_value2,
- donation_value3,
- donation_value4,
- donation_value5,
- } = settings;
-
- return (
-
-
- OBA! Doação Realizada :)
- {/* */}
-
-
-
-
- {/* */}
- Quer aumentar seu impacto?
-
-
Torne essa doação recorrente!
- {/*
*/}
-
-
- Sua contribuição será efetivada automaticamente uma vez ao mês,
- iniciando daqui há 31 dias.
- {/* */}
-
-
-
-
-
-
-
-
- );
-};
-
-export default FormSelect;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/FinishDonationMessage/index.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/FinishDonationMessage/index.tsx
deleted file mode 100644
index edbba6a82a..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/FinishDonationMessage/index.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import React, { useState } from 'react';
-import FormSelect from './FormSelect';
-import TellAFriend from '../TellAFriend';
-// import { TellAFriend } from '..';
-// import { FormattedMessage } from 'react-intl';
-
-// type Props = {
-// defaultSelectedValue: string | number;
-// mobilization: any;
-// widget: any;
-// onClickDonation: any;
-// }
-
-const FinishDonationMessage = ({
- defaultSelectedValue,
- mobilization,
- widget,
- onClickDonate,
- ...ownProps
-}: any) => {
- const [value, setValue] = useState(defaultSelectedValue);
- const [success, setSuccess] = useState(false);
-
- const onChange = (e: any) => {
- setValue(e.currentTarget.value);
- };
-
- if (success) {
- const message = value ? 'donation: ok' : 'donation: not ok';
- return (
-
- );
- }
-
- return (
- {
- await onClickDonate(value);
- setValue(value);
- setSuccess(true);
- }}
- />
- );
-};
-
-export default FinishDonationMessage;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/PagarMeCheckout.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/PagarMeCheckout.tsx
deleted file mode 100644
index a5be204191..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/PagarMeCheckout.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import React, { useState, useEffect } from 'react';
-
-declare global {
- interface Window {
- PagarMeCheckout: any;
- }
-}
-
-type Props = {
- pagarmeKey?: string;
- createTransaction: any;
- donationComponent: any;
-};
-
-type Options = {
- mobilization: any;
- widget: any;
- formValues: {
- value: string;
- paymentType: string;
- recurringPeriod: string;
- };
- customerData?: any;
-};
-
-const PagarMeCheckout = (props: Props | any) => {
- useEffect(() => {
- const script = document.createElement('script');
-
- script.src = "https://assets.pagar.me/checkout/checkout.js";
- script.async = true;
-
- document.body.appendChild(script);
-
- return () => {
- document.body.removeChild(script);
- }
- }, []);
- const [customerData, setCustomerData] = useState();
- const { donationComponent: Donation } = props;
-
- const handleTransactionCreate = (opts: Options) => {
- const { mobilization, widget, formValues } = opts;
- const amount = widget.settings['donation_value' + formValues.value] + '00';
-
- return new Promise((resolve: any, reject: any) => {
- const mainColor = widget.settings.mainColor || '#43a2cc';
- const checkout = new window.PagarMeCheckout.Checkout({
- encryption_key: props.pagarmeKey || 'setup env var',
- success: (data: any) => {
- const genRequestPayload = {
- widget_id: widget.id,
- card_hash: data.card_hash,
- payment_method: data.payment_method,
- amount: amount,
- customer: data.customer,
- subscription: formValues.paymentType !== 'unique',
- period: formValues.recurringPeriod,
- mobilization_id: mobilization.id
- };
-
- return props
- .createTransaction(genRequestPayload)
- .then((resp: any) => {
- // TODO: analyticsEvents.donationFinishRequest()
- return resolve({ donation: resp.data });
- })
- .catch((failure: any) => {
- if (failure.config && failure.config.data) {
- try {
- const failureData = JSON.parse(failure.config.data);
- setCustomerData(failureData.donation.customer);
- } catch (error) {
- console.error(
- 'Customer data is not parsable. Cannot store the customer data.'
- );
- console.error(error);
- }
- } else {
- console.error(failure);
- }
- });
- },
- error: (err: any) => {
- console.error(err);
- return reject();
- },
- });
-
- const data: any = {};
- if (opts.customerData) {
- const d = opts.customerData;
-
- // reference: https://docs.pagar.me/v2017-07-17/docs/inserindo-o-formulario
- data.customerName = d.name;
- data.customerDocumentNumber = d.document_number;
- data.customerEmail = d.email;
- data.customerPhoneDdd = d.phone.ddd;
- data.customerPhoneNumber = d.phone.number;
- data.customerAddressZipcode = d.address.zipcode;
- data.customerAddressStreet = d.address.street;
- data.customerAddressStreetNumber = d.address.street_number;
- data.customerAddressComplementary = d.address.complementary;
- data.customerAddressNeighborhood = d.address.neighborhood;
- data.customerAddressCity = d.address.city;
- data.customerAddressState = d.address.state;
- }
-
- const params = {
- amount,
- createToken: 'false',
- customerData: 'true',
- uiColor: mainColor,
- paymentMethods:
- widget.settings.payment_methods === 'true'
- ? 'credit_card,boleto'
- : 'credit_card',
- paymentButtonText: widget.settings.button_text,
- ...data,
- };
-
- // TODO: analyticsEvents.donationSetValue()
- checkout.open(params);
- });
- };
-
- return (
- <>
-
- >
- );
-};
-
-export default PagarMeCheckout;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ReattemptDonation.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ReattemptDonation.tsx
deleted file mode 100644
index 5b96076234..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ReattemptDonation.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import React from 'react';
-import styled from '@emotion/styled';
-import ReattemptIcon from './ReattemptIcon';
-
-type ReattemptDonationStylesProps = {
- mainColor: string;
-};
-
-const ReattemptDonationStyles = styled.div`
- padding: 3rem;
-
- p {
- text-align: center;
- color: #333;
- margin-bottom: 1rem;
- }
-
- button {
- background-color: ${props => props.mainColor};
- font-family: inherit;
- font-size: 0.875rem;
- font-weight: 700;
- text-decoration: none;
- margin: 3rem 0 0;
- padding: 1em;
- border: 0;
- border-radius: 3px;
- color: #fff;
- text-transform: uppercase;
- box-sizing: border-box;
- width: 100%;
- cursor: pointer;
- }
-
- svg {
- margin-bottom: 1rem;
- }
-`;
-
-type Props = {
- headerFont: string;
- mainColor: string;
- handleClickDonate: any;
-};
-
-const ReattemptDonation = ({
- headerFont,
- mainColor,
- handleClickDonate,
-}: Props) => {
- return (
- <>
- Ops!
-
-
- Algo de errado aconteceu com a sua doação. ):
- Clique no botão abaixo pra tentar de novo.
-
-
- >
- );
-};
-
-export default ReattemptDonation;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ReattemptIcon.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ReattemptIcon.tsx
deleted file mode 100644
index f568b73ee0..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ReattemptIcon.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react';
-
-function Icon() {
- return (
-
- );
-}
-
-export default Icon;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/TellAFriend.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/TellAFriend.tsx
deleted file mode 100644
index 82484eb006..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/TellAFriend.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react';
-import TellAFriendBase from '../../components/ux/TellAFriendBase';
-
-const DonationTellAFriend = ({
- preview,
- mobilization,
- widget,
- ...ownProps
-}: any) => {
- return (
-
- );
-};
-
-export default DonationTellAFriend;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ThankYou.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ThankYou.tsx
deleted file mode 100644
index 2de877654b..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/ThankYou.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import React from 'react';
-import Boleto from './Boleto';
-
-type Props = {
- selectedValue: number;
- donation: any;
- mobilization: any;
- widget: any;
- overrides: any;
- handleConvertDonation: any;
-};
-
-const ThankYou = ({
- donation,
- widget,
- overrides,
- selectedValue,
- handleConvertDonation,
- ...ownProps
-}: Props) => {
- const {
- settings: { finish_message_type: messageType },
- } = widget;
- const {
- FinishCustomMessage: { component: FinishCustomMessage, props: customProps },
- FinishDefaultMessage: {
- component: FinishDefaultMessage,
- props: defaultProps,
- },
- FinishDonationMessage: {
- component: FinishDonationMessage,
- props: donationProps,
- },
- } = overrides;
-
- // Renderizar o componente de Boleto
- if (donation.payment_method === 'boleto' && donation.gateway_data)
- return (
-
- );
-
- if (messageType === 'custom')
- return (
-
- );
-
- if (
- messageType === 'donation-recurrent' &&
- donation.payment_method !== 'boleto'
- ) {
- return (
- {
- if (value) {
- return handleConvertDonation({
- donation_id: donation.id,
- amount: widget.settings['donation_value' + value] + '00',
- });
- }
- }}
- />
- );
- }
-
- return (
-
- );
-};
-
-export default ThankYou;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/asyncDonationConvert.ts b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/asyncDonationConvert.ts
deleted file mode 100644
index 78b66561d1..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/asyncDonationConvert.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-type Params = {
- donation_id: string | number;
- amount: string | number;
-};
-
-const donationTransactionConvert = (params: Params) => (
- _: any,
- __: any,
- { api }: any
-) => {
- const endpoint = `/convert-donation`;
- return api.get(endpoint, { params });
-};
-
-export default donationTransactionConvert;
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/asyncDonationCreate.ts b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/asyncDonationCreate.ts
deleted file mode 100644
index 788bff3aff..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/asyncDonationCreate.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-const donationTransactionCreate = (params: any) => (
- _: any,
- __: any,
- { api }: any
-) => {
- const endpoint = `/mobilizations/${params.mobilization_id}/donations`;
- const body = { donation: genRequestPayload(params) };
- return api.post(endpoint, body);
-};
-
-export default donationTransactionCreate;
-
-const genRequestPayload = (params: any) => ({
- widget_id: params.widget_id,
- card_hash: params.card_hash,
- payment_method: params.payment_method,
- amount: params.amount,
- customer: params.customer,
- subscription: params.subscription,
- period: params.recurring_period,
-});
diff --git a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/index.tsx b/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/index.tsx
deleted file mode 100644
index 3e3afdf70d..0000000000
--- a/clients/packages/webpage-client/src/bonde-webpage/plugins/Donation/index.tsx
+++ /dev/null
@@ -1,190 +0,0 @@
-import React, { useState } from 'react';
-import styled from '@emotion/styled';
-import DonationForm from './DonationFormCreate';
-import ReattemptDonation from './ReattemptDonation';
-import ThankYou from './ThankYou';
-
-type DonationStylesProps = {
- mainColor: string;
-};
-
-const DonationStyles = React.memo(styled.div`
- text-align: center;
- border-radius: 3px 3px 0 0;
- background: #fff;
-
- h2 {
- padding: 1rem;
- color: #fff;
- font-weight: 400;
- margin: 0;
- background-color: ${props => props.mainColor};
- }
-
- &:after,
- &:before {
- content: ' ';
- display: table;
- }
-`);
-
-type Props = {
- extraProps: {
- mainColor: string;
- title: string;
- paymentType: string;
- recurringPeriod: number;
- buttonText: string;
- };
- // ApolloClient instance
- asyncFetchDonationsStats: any;
- asyncDonationCreate?: any;
- asyncDonationConvert?: any;
- donationCustomerData?: any;
- mobilization: any;
- widget: {
- id: number;
- settings: {
- main_color?: string;
- title_text?: string;
- call_to_action?: string;
- button_text?: string;
- payment_type?: string;
- goal_date_limit?: string;
- recurring_period?: number;
- donation_value1?: number;
- donation_value2?: number;
- donation_value3?: number;
- donation_value4?: number;
- donation_value5?: number;
- default_donation_value?: string;
- };
- };
- analyticsEvents: {
- donationSetValue: () => void;
- donationFinishRequest: (value?: string) => void;
- };
- overrides: any;
-};
-
-const DonationPlugin: React.FC = ({
- asyncDonationCreate,
- asyncDonationConvert,
- asyncFetchDonationsStats,
- donationCustomerData,
- extraProps,
- widget,
- mobilization,
- overrides,
- analyticsEvents,
-}) => {
- const { headerFont } = mobilization;
- const {
- settings: {
- main_color: mainColor,
- title_text: titleText,
- call_to_action: callToAction,
- button_text: buttonText,
- payment_type: paymentType,
- recurring_period: recurringPeriod,
- default_donation_value: defaultDonationValue,
- },
- } = widget;
- // States
- const [donation, setDonation] = useState();
- const [selectedPaymentType, setSelectedPaymentType] = useState(
- !!paymentType && paymentType !== 'users_choice'
- ? paymentType
- : extraProps.paymentType
- );
- const [selectedValue, setSelectedValue] = useState(
- parseInt(defaultDonationValue || '1')
- );
- const [loading, setLoading] = useState(false);
-
- const recurringLabel = ({ 30: 'mês', 180: 'semestre', 365: 'ano' } as Record<
- number,
- any
- >)[recurringPeriod || extraProps.recurringPeriod];
-
- const handleClickDonate = () => {
- if (asyncDonationCreate) {
- setLoading(true);
- asyncDonationCreate({
- mobilization,
- widget,
- formValues: {
- value: selectedValue,
- paymentType: selectedPaymentType,
- },
- customerData: donationCustomerData,
- }).then((res: any) => {
- analyticsEvents.donationFinishRequest(String(res.donation.amount).slice(0, -2));
- setDonation(res.donation);
- setLoading(false);
- });
- // .catch((err: any) => {
- // console.log('err', { err });
- // setLoading(false);
- // });
- }
- };
-
- const onSelectValue = (value: any) => {
- analyticsEvents.donationSetValue();
- setSelectedValue(value);
- };
-
- const defaultProps = {
- headerFont,
- handleClickDonate,
- mainColor: mainColor || extraProps.mainColor,
- };
-
- // Workflow Renders
- if (donationCustomerData) return ;
-
- if (donation) {
- return (
-
- );
- }
-
- return (
-
-
-
- );
-};
-
-DonationPlugin.defaultProps = {
- widget: { id: 0, settings: {} },
- extraProps: {
- mainColor: '#54d0f6',
- title: 'Clique para configurar seu bloco de doação',
- paymentType: 'recurring',
- recurringPeriod: 30,
- buttonText: 'Doar agora',
- },
-};
-
-export default DonationPlugin;
diff --git a/clients/packages/webpage-client/src/components/DonationConnected.tsx b/clients/packages/webpage-client/src/components/DonationConnected.tsx
deleted file mode 100644
index 1c9647abb5..0000000000
--- a/clients/packages/webpage-client/src/components/DonationConnected.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import React from 'react';
-import {
- DonationPlugin,
- PagarMeCheckout,
- FinishMessageCustom,
- FinishDonationMessage,
- DonationAnalytics,
- DonationTellAFriend,
-} from '../bonde-webpage';
-import getConfig from 'next/config';
-import fetch from 'node-fetch';
-// import { connect } from 'react-redux';
-
-import Utils from '../Utils';
-
-const { serverRuntimeConfig } = getConfig();
-
-// const mapDispatchToProps = () => ({
-// createTransaction: async (args: any) =>
-// (
-// await fetch('/api/actions/donation', {
-// method: 'post',
-// body: JSON.stringify(args),
-// headers: { 'Content-Type': 'application/json' },
-// })
-// ).json(),
-// asyncDonationConvert: async (args: any) =>
-// (
-// await fetch('/api/actions/donation-convert', {
-// method: 'post',
-// body: JSON.stringify(args),
-// headers: { 'Content-Type': 'application/json' },
-// })
-// ).json(),
-// asyncFetchDonationsStats: async (args: any) =>
-// (
-// await fetch('/api/data/donations', {
-// method: 'post',
-// body: JSON.stringify(args),
-// headers: { 'Content-Type': 'application/json' },
-// })
-// ).json(),
-// });
-
-// interface MobProps {
-// mobilization: any
-// }
-
-const DonationConnected = (props: any) =>
-
- (
- await fetch('/api/data/donations', {
- method: 'post',
- body: JSON.stringify(args),
- headers: { 'Content-Type': 'application/json' },
- })
- ).json()
- }
- asyncDonationConvert={async (args: any) =>
- (
- await fetch('/api/actions/donation-convert', {
- method: 'post',
- body: JSON.stringify(args),
- headers: { 'Content-Type': 'application/json' },
- })
- ).json()
- }
- createTransaction={async (args: any) =>
- (
- await fetch('/api/actions/donation', {
- method: 'post',
- body: JSON.stringify(args),
- headers: { 'Content-Type': 'application/json' },
- })
- ).json()
- }
- pagarmeKey={serverRuntimeConfig.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;
-// export default connect(
-// null,
-// mapDispatchToProps
-// )((props: MobProps) => (
-//
-// ));
diff --git a/clients/packages/webpage-client/stories/DonationPlugin.stories.tsx b/clients/packages/webpage-client/stories/DonationPlugin.stories.tsx
deleted file mode 100644
index e1e44726b7..0000000000
--- a/clients/packages/webpage-client/stories/DonationPlugin.stories.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-// import React from 'react';
-// import { action } from '@storybook/addon-actions';
-// import { createApolloFetch } from 'apollo-fetch';
-// import DonationStats from '../src/plugins/Donation/components/DonationStats';
-// import FetchDonationStats from '../src/plugins/Donation/FetchDonationStats';
-
-// export const donationStats = () =>
-//
-//
-//
-// ;
-
-// export const fetchDonationStats = () => {
-// const props = {
-// fetch: createApolloFetch({ uri: 'https://api-v2.staging.bonde.org/graphql' }),
-// widgetId: 8175,
-// mainColor: 'rgb(5, 144, 70)',
-// goalDateLimit: '30/04/2020',
-// };
-
-// return (
-//
-// );
-// };
-
-export default {
- title: 'DonationPlugin',
-};