remove mock stripe (#1191)

main
Michael Fix 4 years ago committed by GitHub
parent 711210e034
commit 91a7e49e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,4 @@
import React from 'react' import React from 'react'
import { Elements, StripeProvider, CardElement, injectStripe } from 'react-stripe-elements'
import { useAsyncCallback } from 'actionsack' import { useAsyncCallback } from 'actionsack'
import Button from './Button' import Button from './Button'
@ -24,22 +23,11 @@ const X = (
</svg> </svg>
) )
function Billing(props) { export default function Billing() {
const user = useAuth() const user = useAuth()
const [submit, { error, loading, data: success }] = useAsyncCallback(async e => { const [submit, { error, loading }] = useAsyncCallback(() => true)
e.preventDefault() const success = true
const name = e.target.name.value.trim()
const res = await props.stripe.createToken({ name })
if (res.error) {
throw res.error.message
}
return {}
})
if (!user) { if (!user) {
return ( return (
@ -70,10 +58,9 @@ function Billing(props) {
<p className="success"> <p className="success">
However, Carbon Diamond is not quite ready yet. However, Carbon Diamond is not quite ready yet.
<br /> <br />
Your card has <u>not</u> been charged or saved today. {/* Your card has <u>not</u> been charged or saved today. */}
<br /> <br />
We greatly appreciate your support, and will contact you when these premium features We greatly appreciate your support, and will let you know when premium features launch!
launch!
</p> </p>
<p className="success"> <p className="success">
the Carbon Team{' '} the Carbon Team{' '}
@ -92,32 +79,7 @@ function Billing(props) {
<p>Please enter a credit or debit card:</p> <p>Please enter a credit or debit card:</p>
<form onSubmit={submit}> <form onSubmit={submit}>
<fieldset> <fieldset>
<CardElement {/** Insert Stripe element here */}
{...{
iconStyle: 'solid',
style: {
base: {
iconColor: COLORS.BLUE,
color: COLORS.BLUE,
fontWeight: 500,
fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',
fontSize: '16px',
fontSmoothing: 'antialiased',
':-webkit-autofill': {
color: '#fce883',
},
'::placeholder': {
color: 'rgba(255, 255, 255, 0.7)',
},
},
invalid: {
iconColor: COLORS.RED,
color: COLORS.RED,
},
},
}}
/>
<hr /> <hr />
<Input placeholder="Cardholders's name…" name="name" required /> <Input placeholder="Cardholders's name…" name="name" required />
</fieldset> </fieldset>
@ -261,19 +223,3 @@ function Billing(props) {
</div> </div>
) )
} }
const BillingWithStripe = injectStripe(Billing)
export default function BillingPage() {
const [stripe, setStripe] = React.useState(null)
React.useEffect(() => {
setStripe(window.Stripe(process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY))
}, [])
return (
<StripeProvider stripe={stripe}>
<Elements>
<BillingWithStripe />
</Elements>
</StripeProvider>
)
}

@ -65,7 +65,6 @@
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-image-crop": "^6.0.16", "react-image-crop": "^6.0.16",
"react-mailchimp-subscribe": "^2.1.0", "react-mailchimp-subscribe": "^2.1.0",
"react-stripe-elements": "^6.1.2",
"serialize-javascript": "^5.0.1", "serialize-javascript": "^5.0.1",
"tohash": "^1.0.2", "tohash": "^1.0.2",
"use-climate-change-reminder": "^0.0.7" "use-climate-change-reminder": "^0.0.7"

@ -1,13 +1,11 @@
// Theirs // Theirs
import React from 'react' import React from 'react'
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
import Head from 'next/head'
// Ours // Ours
import Button from '../components/Button' import Button from '../components/Button'
import Page from '../components/Page' import Page from '../components/Page'
import MenuButton from '../components/MenuButton' import MenuButton from '../components/MenuButton'
import { MetaLinks } from '../components/Meta'
import { useAuth } from '../components/AuthContext' import { useAuth } from '../components/AuthContext'
import { loginGitHub, logout } from '../lib/client' import { loginGitHub, logout } from '../lib/client'
@ -250,10 +248,6 @@ function Settings() {
function SettingsPage() { function SettingsPage() {
return ( return (
<Page flex={true}> <Page flex={true}>
<Head>
<script src="https://js.stripe.com/v3/" />
</Head>
<MetaLinks />
<Settings /> <Settings />
</Page> </Page>
) )

@ -8474,13 +8474,6 @@ react-refresh@0.8.3:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"
integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg== integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==
react-stripe-elements@^6.1.2:
version "6.1.2"
resolved "https://registry.yarnpkg.com/react-stripe-elements/-/react-stripe-elements-6.1.2.tgz#bd277e86d0b868a6fac9358df09e0d38149b6736"
integrity sha512-gYbYhVVJm3Woc84TgmuiqUj44rI/BZGUVUTTmS0U6kZyZa5fYMPlKKIsVZdQZufQ7Ab4BXLO2LSxBlGY0s2jew==
dependencies:
prop-types "15.7.2"
react@^17.0.1: react@^17.0.1:
version "17.0.1" version "17.0.1"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127" resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127"

Loading…
Cancel
Save