Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors email signup form to use gatsby-plugin-mailchimp #4589

Merged
merged 155 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
26a3993
Refactors email signup form to use gatsby-plugin-mailchimp
benjaminhoffman Mar 18, 2018
bfa4f4a
Adds two babel plugins
benjaminhoffman Mar 24, 2018
8d5aedc
Refactors email signup form to use gatsby-plugin-mailchimp
benjaminhoffman Mar 18, 2018
f4914ba
Adds two babel plugins
benjaminhoffman Mar 24, 2018
ba2254b
Merge branch 'mailchimp2' of github.com:benjaminhoffman/gatsby into m…
benjaminhoffman Apr 14, 2018
943febc
Refactors from async/await to then/catch
benjaminhoffman Apr 14, 2018
25ebc41
Removes useless gatsby-node change
benjaminhoffman Apr 14, 2018
127be53
Bumps dep version
benjaminhoffman Apr 14, 2018
454169d
Refactors email signup form to use gatsby-plugin-mailchimp
benjaminhoffman Mar 18, 2018
52f6032
Adds two babel plugins
benjaminhoffman Mar 24, 2018
9ad11e8
Consistently use `npm` instead of `yarn` [Docs][Review] (#4607)
giladronat Mar 24, 2018
fddc9c1
remark-prismjs: add aliases for languages (#4688)
docwhat Mar 24, 2018
7beb197
internally use Map() in getState()'s pages (#4681)
docwhat Mar 24, 2018
c272df1
Publish
KyleAMathews Mar 24, 2018
4b09432
Add direct link to download VS Community 2015
josueus Mar 24, 2018
1ee89c0
Add CodeBushi to showcase
ChangoMan Mar 25, 2018
f0f6f57
Add Gatsby Starter Tailwind
taylorbryant Mar 25, 2018
2a0a33c
Add philippczernitzki.me to Showcase (#4710)
Mar 26, 2018
0ecd4ae
Also point to download page and update description
m-allanson Mar 26, 2018
f6971da
[www] Fix logic to determine selected plugin from list (#4706)
tsriram Mar 26, 2018
28a5f16
Fix #4503 (#4698)
jeffwillette Mar 26, 2018
b1ac6ae
Change the name & description of gatsbyjs.org (#4713)
giladronat Mar 26, 2018
35ab17f
Publish
KyleAMathews Mar 26, 2018
a18f47e
Add docs page on setting up Linux for Gatsby (#4716)
spences10 Mar 26, 2018
04cb425
Document gatsby-link being only for internal links (#4720)
tremby Mar 26, 2018
bd0a124
Add support for the Styled Components Babel plugin (#4722)
KyleAMathews Mar 26, 2018
1f0b58d
Publish
KyleAMathews Mar 26, 2018
b9506a5
Fix typo on Linux docs page (#4728)
spences10 Mar 27, 2018
29d52a6
Add Gatsby Starter Bloomer (#4731)
Cethy Mar 27, 2018
e44d40b
Add SSR support to i18next article (#4582)
joehua87 Mar 27, 2018
0b2a244
Add WebGazer to Showcase sites on README
th0th Mar 27, 2018
9ab579a
[gatsby-transformer-remark] Don't generate AST for same node multiple…
pieh Mar 27, 2018
3d940b9
Queue page requests to wp endpoints (#4735)
tsimons Mar 27, 2018
a894a48
[www] Move Plugins page from /packages to /plugins (#4705)
tsriram Mar 27, 2018
3f3e51a
Publish
KyleAMathews Mar 27, 2018
3456302
Add gatsby-starter-i18n-lingui (#4741)
dcroitoru Mar 28, 2018
19662e7
Add smakosh.com to Showcase (#4678)
smakosh Mar 28, 2018
861346d
[remark-autolink-headers] Show anchor when :focus'ed (#4739)
yuheiy Mar 28, 2018
92a7c3d
[gatsby-source-wordpress] support for exlcuded manufacturers and type…
lightstrike Mar 28, 2018
e83e573
[gatsby-source-wordpress] Link Parent pages to pages (#4747)
sebastienfi Mar 28, 2018
6b51568
Publish
KyleAMathews Mar 29, 2018
6c9caf3
Publish
KyleAMathews Mar 29, 2018
dd1f2e4
Adding a new site built with Gatsby (#4752)
Mar 29, 2018
0f41706
Update CONTRIBUTING_ES.md
royeden Mar 29, 2018
991e9b8
Update README.md (#4764)
calcsam Mar 29, 2018
6c7b2c1
Add HS Hackathons to projects list
maxwofford Mar 29, 2018
5afe938
updating scrape.js for gatsbygram (#4777)
Jaikant Mar 30, 2018
4c451b9
Add seo docs (#4766)
calcsam Mar 30, 2018
73b232f
Correct potential miscommunication in SEO doc (#4778)
KyleAMathews Mar 30, 2018
510d2b6
add Bartosz Dominiak site to showcase (#4784)
bartdominiak Mar 31, 2018
e2f2748
Publish
KyleAMathews Apr 1, 2018
74ca2dd
Add OutboundLink component to gatsby-plugin-google-analytics + track …
KyleAMathews Apr 1, 2018
7678250
Document new component <OutboundLink> (#4787)
KyleAMathews Apr 1, 2018
616d3b2
Publish
KyleAMathews Apr 1, 2018
9e9c4df
Add banner for Gatsby workshops (#4788)
KyleAMathews Apr 1, 2018
31f3391
Publish
KyleAMathews Apr 1, 2018
5c7d096
Update gatsby-starters.md (#4798)
v4iv Apr 2, 2018
46d9e59
Add Photon to starters (#4781)
ChangoMan Apr 2, 2018
4352d3d
Don't query for unnecessary fields in gatsby-node.js createPages so p…
KyleAMathews Apr 2, 2018
a7f559c
Remove unnecessary fourth backtick (#4796)
HarrisJT Apr 2, 2018
98deb5a
Fix typo (#4794)
PaulRosset Apr 2, 2018
4a1d324
readme: Add Rohit's HBTU MUN site (#4791)
HaoZeke Apr 2, 2018
334f76e
Improve description and keywords for gatsby-plugin-react-helmet so mo…
KyleAMathews Apr 2, 2018
24d58ae
Publish
KyleAMathews Apr 2, 2018
e290ec9
Added blog post (#4758)
vojtechruz Apr 2, 2018
e3db253
Flag to disable uglify for production builds (#4755)
tsriram Apr 2, 2018
fc4429d
Publish
KyleAMathews Apr 2, 2018
2704e6a
Fix banner styles (#4808)
KyleAMathews Apr 2, 2018
96d0896
Queue requests from createRemoteFileNode and control concurrency of r…
tsimons Apr 3, 2018
24852a3
Banner positioning fix for www (#4810)
kkemple Apr 3, 2018
70532eb
Fix spelling error (#4819)
Apr 3, 2018
0536c46
responsiveResolution is depracated (#4811)
daydream05 Apr 3, 2018
156010f
Publish
KyleAMathews Apr 3, 2018
035a8a6
Add Storybook to Websites built with Gatsby (#4824)
mshaaban088 Apr 3, 2018
1d3562f
Don't handle line highlights unless there's actually line highlights …
KyleAMathews Apr 3, 2018
b59f36b
Publish
KyleAMathews Apr 3, 2018
070240f
Add protocol to Storybook website (#4825)
mshaaban088 Apr 3, 2018
86cf8e2
Tags to posts (#4782)
calcsam Apr 3, 2018
91c00b6
links to plugin authoring page added and fixed (#4822)
shannonbux Apr 3, 2018
3bfb711
[starters] Add gatsby-starter-typescript-plus (#4821)
resir014 Apr 3, 2018
c018ab9
add local time designators for ISO 8601 format (#4813)
grantmoran Apr 3, 2018
2cec7f9
Publish
KyleAMathews Apr 3, 2018
c4b5f0a
Add new example doc: GraphQL Reference/Query Variables (#4795)
PaulRosset Apr 4, 2018
47565cc
Omit undefined attributes from noscript images (#4639)
ooloth Apr 4, 2018
d6a6aba
improve error message for graphql queries (#4615)
docwhat Apr 4, 2018
e3f4224
Publish
KyleAMathews Apr 4, 2018
90033ba
Styleguide example (#3304)
scottyeck Apr 4, 2018
4d81779
Update README.md (#4829)
arsdehnel Apr 4, 2018
8d80bf3
add audacious project to showcase
VinSpee Apr 4, 2018
35c75ac
[gatsby-source-wordpress] Handle all media types (#4817)
sebastienfi Apr 4, 2018
57568e1
add new starter (gatsby advanced blog)
wonism Apr 4, 2018
e91c2d0
Publish
KyleAMathews Apr 4, 2018
aec4fc2
Add missing import
m-allanson Apr 4, 2018
55de70a
Completed instructions to use gatsby-transformer-excel (#4852)
SebastienBelmon Apr 5, 2018
2803f7c
iPhone X support (#4835)
codeOfRobin Apr 5, 2018
6edb210
change pathPrefix from a plugin option to passed opt (#4841)
seryl Apr 5, 2018
69061f9
Updating gatsby-plugin-manifest (#4382)
moonmeister Apr 5, 2018
a37fcb1
Publish
KyleAMathews Apr 5, 2018
82a0111
Update Gatsbygram data from instagram (#4855)
KyleAMathews Apr 5, 2018
bc49a75
[gatsby-source-wordpress] take advantage of `modified` field in media…
pieh Apr 6, 2018
73d915d
Publish
KyleAMathews Apr 6, 2018
f177436
Add blog post introducing RFC process (#4876)
KyleAMathews Apr 6, 2018
6adb2ef
[gatsby-source-filesystem/createRemoteFileNode] wait for file stream …
pieh Apr 6, 2018
9dd01c5
Publish
KyleAMathews Apr 6, 2018
0995a51
Correct the name of the WordPress REST API
joshsmith01 Apr 7, 2018
199c7e7
fix(gatsby-transfomer-remark): memory leak of ASTPromiseMap
DxCx Apr 7, 2018
a140831
Remove redundantcy in WordPress' API name
joshsmith01 Apr 7, 2018
9794ef7
Move default icons to common file (#4867)
alampros Apr 7, 2018
8e65718
Publish
KyleAMathews Apr 7, 2018
9e0baf3
Link Gatsbygram Case Study in README (#4879)
giladronat Apr 7, 2018
517ccfa
Handle banner in sidebar styles fixes #4878 (#4886)
KyleAMathews Apr 7, 2018
1e33816
Adds new starter "gatsby-starter-procyon" (#4871)
danielmahon Apr 7, 2018
5d6665e
Add dependency instruction (#4869)
noeleont Apr 7, 2018
920172d
Explained what cd means for starter installation (#4737)
shannonbux Apr 7, 2018
42f92ec
Don't add an extra trailing newline part deux (#4831)
docwhat Apr 7, 2018
a9ccb42
Publish
KyleAMathews Apr 7, 2018
174e285
Add gatsby-starter-2column-portfolio starter (#4883)
praagyajoshi Apr 8, 2018
327a3cc
adjust indices used for extracting graphqlparser errors after adding …
pieh Apr 8, 2018
c546561
Publish
KyleAMathews Apr 8, 2018
2885b74
Formatting fix in Readme (#4897)
osartun Apr 9, 2018
193d2a9
Relocate manifest.json to ./public/ (#4890)
dojineko Apr 9, 2018
7e66303
Add upGizmo to showcase (#4902)
philipedin Apr 9, 2018
2382f44
Publish
KyleAMathews Apr 9, 2018
680daea
Extract `getNode` method from `args`, not `boundActionCreators` (#4907)
coreyward Apr 10, 2018
08f6d8a
Publish
KyleAMathews Apr 10, 2018
fb39e4f
feat: add airtable tutorial
kkemple Apr 10, 2018
a2c62bc
move gatsby to automated Icon generation with new manifest plugin fea…
moonmeister Apr 10, 2018
a018b80
update CONTRIBUTING.md with DCO section (#4924)
pieh Apr 10, 2018
19b7bb0
Added bastionbot.org to showcase (#4909)
iamtraction Apr 11, 2018
851f795
Fix the version of imagemin-pngquant (#4915)
shaunbent Apr 11, 2018
5fc12c4
Blog Post - Comments with Gatsby (#4916)
Apr 11, 2018
4d6244f
feat: add simple auth example (#4923)
jlengstorf Apr 11, 2018
849ce36
Added createTypeName to ensure unique name for union types. (#4925)
michaek Apr 11, 2018
0c79c91
Publish
KyleAMathews Apr 11, 2018
95f0c6d
Update building-apps-with-gatsby.md
KyleAMathews Apr 11, 2018
2553893
Fix typo
m-allanson Apr 11, 2018
e3930e5
add yuuniworks.com to showcase
tam315 Apr 11, 2018
7e9bfdc
Ignore nodes with no URL field (#4930)
cassiebeckley Apr 11, 2018
219b657
Documentation for multiple environments (#4858)
jongear Apr 11, 2018
1f53e6f
chore(npm source): use index.browse (#4861)
Haroenv Apr 11, 2018
f032c3d
Grammar fixes in tutorial. (#4928)
twhiteaker Apr 11, 2018
35ed912
Add chinloongtan.com to showcase
chinloongtan Apr 11, 2018
d39277b
Changed createNode docs to show parent should be set to null instead …
graysonhicks Apr 12, 2018
01db428
Quick fix for www
m-allanson Apr 12, 2018
f0185b7
Fix link in blog post (#4959)
agarrharr Apr 12, 2018
39fc7d6
Blog post - Trying out Gatsby at Work & Co (#4945)
sarahatwork Apr 12, 2018
c83797d
Add F1 Vision to showcase (#4958)
marbiano Apr 12, 2018
7c9508f
Small fixes to source-wordpress README
KyleAMathews Apr 13, 2018
d1e9ce4
Fix typo
KyleAMathews Apr 13, 2018
3e4492f
Refactors email signup form to use gatsby-plugin-mailchimp
benjaminhoffman Mar 18, 2018
1cfedfa
Refactors from async/await to then/catch
benjaminhoffman Apr 14, 2018
05936f0
Removes useless gatsby-node change
benjaminhoffman Apr 14, 2018
416c732
Bumps dep version
benjaminhoffman Apr 14, 2018
522205a
Merge branch 'mailchimp' of github.com:benjaminhoffman/gatsby into ma…
benjaminhoffman Apr 14, 2018
fc6f8de
removes useless deps
benjaminhoffman Apr 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions www/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,11 @@ module.exports = {
},
},
`gatsby-plugin-netlify`,
{
resolve: `gatsby-plugin-mailchimp`,
options: {
endpoint: `https://gatsbyjs.us17.list-manage.com/subscribe/post-json?u=1dc33f19eb115f7ebe4afe5ee&amp;id=f366064ba7`,
},
},
],
}
6 changes: 2 additions & 4 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"author": "Kyle Mathews <[email protected]>",
"dependencies": {
"bluebird": "^3.5.1",
"email-validator": "1.1.1",
"gatsby": "^1.9.246",
"gatsby-image": "^1.0.43",
"gatsby-link": "^1.6.40",
Expand All @@ -15,6 +14,7 @@
"gatsby-plugin-glamor": "^1.6.13",
"gatsby-plugin-google-analytics": "^1.0.28",
"gatsby-plugin-lodash": "^1.0.11",
"gatsby-plugin-mailchimp": "^1.1.1",
"gatsby-plugin-manifest": "^1.0.19",
"gatsby-plugin-netlify": "^1.0.19",
"gatsby-plugin-nprogress": "^1.0.14",
Expand All @@ -41,7 +41,6 @@
"graphql-request": "^1.5.1",
"gray-percentage": "^2.0.0",
"hex2rgba": "^0.0.1",
"jsonp": "^0.2.1",
"limax": "^1.5.0",
"lodash": "^4.17.5",
"mitt": "^1.1.3",
Expand All @@ -53,8 +52,7 @@
"typeface-space-mono": "^0.0.54",
"typeface-spectral": "^0.0.54",
"typography-breakpoint-constants": "^0.15.10",
"typography-plugin-code": "^0.16.11",
"validator": "^9.4.1"
"typography-plugin-code": "^0.16.11"
},
"keywords": [
"gatsby"
Expand Down
73 changes: 24 additions & 49 deletions www/src/components/email-capture-form.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from "react"
import { rhythm, options } from "../utils/typography"
import presets, { colors } from "../utils/presets"
import jsonp from "jsonp"
import { validate } from "email-validator"
import { css } from "glamor"
import hex2rgba from "hex2rgba"
import addToMailchimp from 'gatsby-plugin-mailchimp'

let stripeAnimation = css.keyframes({
"0%": { backgroundPosition: `0 0` },
Expand All @@ -28,12 +27,6 @@ const formInputDefaultStyles = {
},
}

// Mailchimp endpoint
// From: https://us17.admin.mailchimp.com/lists/integration/embeddedcode?id=XXXXXX
// Where `XXXXXX` is the MC list ID
// Note: we change `/post` to `/post-json`
const MAILCHIMP_URL = `https://gatsbyjs.us17.list-manage.com/subscribe/post-json?u=1dc33f19eb115f7ebe4afe5ee&amp;id=f366064ba7`

class EmailCaptureForm extends React.Component {
constructor() {
super()
Expand All @@ -47,64 +40,46 @@ class EmailCaptureForm extends React.Component {
this.setState({ email: e.target.value })
}

// Using jsonp, post to MC server & handle its response
_postEmailToMailchimp = url => {
// jsonp lib takes an `endpoint`, {options}, & callback
jsonp(url, { param: `c` }, (err, data) => {
// network failures, timeouts, etc
if (err) {
this.setState({
status: `error`,
msg: err,
})

// Mailchimp errors & failures
} else if (data.result !== `success`) {
// Post to MC server & handle its response
_postEmailToMailchimp = (email, attributes) => {
addToMailchimp(email, attributes)
.then(result => {
// Mailchimp always returns a 200 response
// So we check the result for MC errors & failures
if (result.result !== `success`) {
this.setState({
status: `error`,
msg: data.msg,
msg: result.msg,
})

// Posted email successfully to Mailchimp
} else {
// Email address succesfully subcribed to Mailchimp
this.setState({
status: `success`,
msg: data.msg,
msg: result.msg,
})
}
})
.catch(err => {
// Network failures, timeouts, etc
this.setState({
status: `error`,
msg: err,
})
})
}

// On form submit, validate email
// then jsonp to Mailchimp, and update state
_handleFormSubmit = e => {
e.preventDefault()
e.stopPropagation()

// If email is not valid, break early
if (!validate(this.state.email)) {
this.setState({
status: `error`,
msg: `"${this.state.email}" is not a valid email address`,
})
return
}

// Construct the url for our jsonp request
// Query params must be in CAPS
// Capture pathname for better email targeting
const url = `${MAILCHIMP_URL}
&EMAIL=${encodeURIComponent(this.state.email)}
&PATHNAME=${window.location.pathname}
`

this.setState(
{
msg: null,
this.setState({
status: `sending`,
msg: null,
},
// jsonp request as setState callback
this._postEmailToMailchimp(url)
// setState callback (subscribe email to MC)
this._postEmailToMailchimp(this.state.email, {
pathname: document.location.pathname,
})
)
}

Expand Down