This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove Hubspot pageview tracking * Rename lead form to HIPAA guide form * Refactor UTM param fetching * Remove modal signup form * Link all signup CTAs to deploy-ui
- Loading branch information
Showing
9 changed files
with
61 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,41 @@ | ||
import React, { useState } from 'react'; | ||
import React from 'react'; | ||
import cn from 'classnames'; | ||
import styles from './SignupForm.module.css'; | ||
import buttonStyles from '../buttons/Button.module.css'; | ||
import { submitHubspotForm, HUBSPOT_FORM_PRODUCT_SIGNUP } from '../../lib/hubspot.js'; | ||
import { analytics } from '../../lib/aptible'; | ||
import Button from '../buttons/Button'; | ||
|
||
export const SignupForm = ({ | ||
id, | ||
btnText = 'Sign Up For Free', | ||
inputPlaceholder = 'Enter your email', | ||
allowPersonalEmails = true, | ||
onSuccess = () => { }, | ||
theme = '', | ||
size = '', | ||
}) => { | ||
const [submitted, setSubmitted] = useState(false); | ||
const [email, setEmail] = useState(''); | ||
const [error, setError] = useState(''); | ||
const onSubmit = () => { | ||
let url = 'https://dashboard.aptible.com/signup'; | ||
const utms = analytics.allUtmVars(); | ||
|
||
const onKeypress = (e) => { | ||
if (e.key === 'Enter') { | ||
onSubmit(); | ||
} | ||
}; | ||
if (Object.keys(utms).length > 0) { | ||
const params = []; | ||
for (let param in utms) { | ||
params.push(`${param}=${utms[param]}`); | ||
} | ||
|
||
const onSubmit = () => { | ||
const result = submitHubspotForm(HUBSPOT_FORM_PRODUCT_SIGNUP, email, allowPersonalEmails); | ||
if (!result.ok) { | ||
setError(result.message); | ||
return; | ||
url += `?${params.join('&')}`; | ||
} | ||
|
||
setSubmitted(true); | ||
setError(''); | ||
onSuccess(); | ||
|
||
// Give time for HubSpot & analytics to fire | ||
setTimeout(() => { | ||
window.location = `https://dashboard.aptible.com/signup?email=${encodeURIComponent(email)}`; | ||
}, 250); | ||
window.location = url; | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div | ||
className={styles.signupFormContainer} | ||
style={{ opacity: submitted ? 0 : 1 }} | ||
<Button | ||
className={cn(buttonStyles.button, styles.button)} | ||
onClickFn={onSubmit} | ||
theme={theme} | ||
size={size} | ||
> | ||
<div className={styles.signupForm} id={id}> | ||
<input | ||
required | ||
className={styles.signupFormInput} | ||
onKeyPress={onKeypress} | ||
onChange={e => setEmail(e.target.value)} | ||
type="email" | ||
placeholder={inputPlaceholder} | ||
/> | ||
<button | ||
className={cn(buttonStyles.button, styles.button)} | ||
type="submit" | ||
onClick={onSubmit} | ||
> | ||
{btnText} | ||
</button> | ||
</div> | ||
<div className={styles.error}>{error ? error : ''}</div> | ||
</div> | ||
{btnText} | ||
</Button> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,14 @@ | ||
import React from 'react'; | ||
import Button from '../buttons/Button'; | ||
import Signup from '../signup/Signup'; | ||
|
||
class SignupButton extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
open: false, | ||
}; | ||
} | ||
|
||
openForm() { | ||
this.setState({ open: true }); | ||
} | ||
|
||
closeForm() { | ||
this.setState({ open: false }); | ||
} | ||
|
||
render() { | ||
return ( | ||
<> | ||
<Button | ||
onClickFn={() => this.openForm()} | ||
theme={this.props.theme} | ||
size={this.props.size} | ||
> | ||
{this.props.text} | ||
</Button> | ||
|
||
{this.state.open && <Signup product="deploy" closeFn={() => this.closeForm()} />} | ||
</> | ||
); | ||
} | ||
} | ||
|
||
export default SignupButton; | ||
import SignupForm from '../signup-form'; | ||
|
||
const SignupButton = ({ | ||
text = 'Sign Up For Free', | ||
theme = '', | ||
size = '', | ||
}) => { | ||
return ( | ||
<SignupForm btnText={text} theme={theme} size={size} /> | ||
); | ||
}; | ||
|
||
export default SignupButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters