Skip to content

Commit

Permalink
fix: prefill newsletter segment (ory#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jul 2, 2020
1 parent c1b4f82 commit bdd88e5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/components/newsletter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ interface StateTypes {
email: string
}

const projects = {
kratos: '&group[17097][4]=1',
hydra: '&group[17097][8]=1',
oathkeeper: '&group[17097][16]=1',
keto: '&group[17097][32]=1'
}

interface PropTypes {
left?: ReactNode
light?: boolean
preselect: keyof projects
}

class Newsletter extends Component<PropTypes, StateTypes> {
Expand All @@ -19,7 +27,7 @@ class Newsletter extends Component<PropTypes, StateTypes> {
e.preventDefault()
window.open(
'https://ory.us10.list-manage.com/subscribe?u=ffb1a878e4ec6c0ed312a3480&id=f605a41b53&MERGE0=' +
encodeURIComponent(this.state.email)
encodeURIComponent(this.state.email) + (this.props.preselect ? projects[this.props.preselect] : '')
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/hydra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const HydraPage = () => (
mobile={[<HydraAnimation />]}
/>

<Newsletter />
<Newsletter preselect="hydra" />
<CompressedSection
expanded
left={
Expand Down
2 changes: 1 addition & 1 deletion src/pages/keto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const KetoPage = () => (
mobile={[<KetoAnimation />]}
/>

<Newsletter />
<Newsletter preselect={"keto"}/>
<CompressedSection
right={<KetoSdk />}
left={
Expand Down
2 changes: 1 addition & 1 deletion src/pages/kratos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const KratosPage = () => (
mobile={[<KratosAnimation />]}
/>

<Newsletter />
<Newsletter preselect={"kratos"}/>
<CompressedSection
expanded
left={
Expand Down
2 changes: 1 addition & 1 deletion src/pages/oathkeeper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const OathkeeperPage = () => (
mobile={[<OathkeeperAnimation />]}
/>

<Newsletter />
<Newsletter preselect={"oathkeeper"}/>

<CompressedSection
expanded
Expand Down

0 comments on commit bdd88e5

Please sign in to comment.