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 { Elements, StripeProvider, CardElement, injectStripe } from 'react-stripe-elements'
import { useAsyncCallback } from 'actionsack'
import Button from './Button'
@ -24,22 +23,11 @@ const X = (
</svg>
)
function Billing(props) {
export default function Billing() {
const user = useAuth()
const [submit, { error, loading, data: success }] = useAsyncCallback(async e => {
e.preventDefault()
const name = e.target.name.value.trim()
const res = await props.stripe.createToken({ name })
if (res.error) {
throw res.error.message
}
return {}
})
const [submit, { error, loading }] = useAsyncCallback(() => true)
const success = true
if (!user) {
return (
@ -70,10 +58,9 @@ function Billing(props) {
<p className="success">
However, Carbon Diamond is not quite ready yet.
<br />
Your card has <u>not</u> been charged or saved today.
{/* Your card has <u>not</u> been charged or saved today. */}
<br />
We greatly appreciate your support, and will contact you when these premium features
launch!
We greatly appreciate your support, and will let you know when premium features launch!
</p>
<p className="success">
the Carbon Team{' '}
@ -92,32 +79,7 @@ function Billing(props) {
<p>Please enter a credit or debit card:</p>
<form onSubmit={submit}>
<fieldset>
<CardElement
{...{
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,
},
},
}}
/>
{/** Insert Stripe element here */}
<hr />
<Input placeholder="Cardholders's name…" name="name" required />
</fieldset>
@ -261,19 +223,3 @@ function Billing(props) {
</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-image-crop": "^6.0.16",
"react-mailchimp-subscribe": "^2.1.0",
"react-stripe-elements": "^6.1.2",
"serialize-javascript": "^5.0.1",
"tohash": "^1.0.2",
"use-climate-change-reminder": "^0.0.7"

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

@ -8474,13 +8474,6 @@ react-refresh@0.8.3:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"
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:
version "17.0.1"
resolved "https://registry.yarnpkg.com/react/-/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127"

Loading…
Cancel
Save