Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 21db622

Browse files
authored
Changes to contact form (#468)
1 parent 1b0cc08 commit 21db622

File tree

2 files changed

+49
-18
lines changed

2 files changed

+49
-18
lines changed

api/contact.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default async function handlerAsync(req: VercelRequest, res: VercelRespon
2727
role,
2828
currentTradingVolume,
2929
isApplicationLive,
30-
// productOfInterest,
30+
productOfInterest,
3131
chainOfInterest,
3232
usageDescription,
3333
timelineForIntegration,
@@ -42,12 +42,12 @@ export default async function handlerAsync(req: VercelRequest, res: VercelRespon
4242
last_name: lastName,
4343
email,
4444
website: linkToProductOrWebsite,
45+
Website: linkToProductOrWebsite,
4546
company: companyName,
4647
'00N8c00000drpGS': typeOfBusiness,
4748
'00N8c00000drpLI': role,
4849
'00N8c00000drpLS': currentTradingVolume,
4950
'00N8c00000drpLm': `${isApplicationLive}`,
50-
// '00N8c00000drpLw': productOfInterest,
5151
'00N8c00000drr36': chainOfInterest,
5252
'00N8c00000ds8KX': timelineForIntegration,
5353
'00N8c00000drpgB': usageDescription,
@@ -56,12 +56,17 @@ export default async function handlerAsync(req: VercelRequest, res: VercelRespon
5656
'00N8c00000drvT8': referral,
5757
};
5858

59+
const bodyInit = new URLSearchParams(payload as { [s: string]: string });
60+
for (const product of productOfInterest.split(',')) {
61+
bodyInit.append('00N8c00000drpLw', product);
62+
}
63+
5964
await fetch('https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8', {
6065
method: 'POST',
6166
headers: {
6267
'Content-Type': 'application/x-www-form-urlencoded',
6368
},
64-
body: new URLSearchParams(payload as { [s: string]: string }),
69+
body: bodyInit,
6570
});
6671

6772
return res.send('Created successfully');

ts/components/modals/modal_contact.tsx

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { GlobalStyle } from 'ts/constants/globalStyle';
1212
import { colors } from 'ts/style/colors';
1313
import { utils } from 'ts/utils/utils';
1414

15-
// const products = ['0x Swap API'] as const;
16-
1715
const timelineForIntegrationOptions = [
1816
'I’ve already integrated!',
1917
'0-3 months',
@@ -81,7 +79,7 @@ export class ModalContact extends React.Component<Props> {
8179
isApplicationLive: false,
8280
currentTradingVolume: '0',
8381
link: '',
84-
// productOfInterest: '0x Swap API',
82+
productOfInterest: [] as string[],
8583
chainOfInterest: '',
8684
chainOfInterestOther: '',
8785
usageDescription: '',
@@ -203,7 +201,7 @@ export class ModalContact extends React.Component<Props> {
203201
<InputRow>
204202
<Input
205203
name="companyName"
206-
label="Name of Company"
204+
label="Company Name"
207205
type="text"
208206
value={this.state.companyName}
209207
required={true}
@@ -270,29 +268,55 @@ export class ModalContact extends React.Component<Props> {
270268
<InputRow>
271269
<Input
272270
name="linkToProductOrWebsite"
273-
label="Link to Product or Website"
271+
label="Company Website"
274272
type="text"
275273
value={this.state.linkToProductOrWebsite}
276274
required={false}
277275
errors={errors}
278276
onChange={this._makeOnChangeHandler('linkToProductOrWebsite')}
279277
/>
280278
</InputRow>
281-
{/* <InputRow>
282-
<GenericDropdown
283-
label="Which Products are you interested in?"
284-
name="productOfInterest"
285-
items={products}
286-
defaultValue={this.state.productOfInterest}
287-
onItemSelected={(selectedProducts) => {
288-
this.setState({ productOfInterest: selectedProducts });
279+
<InputRow>
280+
<StyledSpan>Which Products are you interested in?</StyledSpan>
281+
</InputRow>
282+
<InputRow>
283+
<CheckBoxInput
284+
label="0x API"
285+
isSelected={this.state.productOfInterest.includes('0x Swap API')}
286+
onClick={() => {
287+
if (this.state.productOfInterest.includes('0x Swap API')) {
288+
this.setState({
289+
productOfInterest: this.state.productOfInterest.filter(
290+
(item) => item !== '0x Swap API',
291+
),
292+
});
293+
} else {
294+
this.setState({ productOfInterest: [...this.state.productOfInterest, '0x Swap API'] });
295+
}
296+
}}
297+
/>
298+
<CheckBoxInput
299+
label="Data API (beta)"
300+
isSelected={this.state.productOfInterest.includes('Data API (beta)')}
301+
onClick={() => {
302+
if (this.state.productOfInterest.includes('Data API (beta)')) {
303+
this.setState({
304+
productOfInterest: this.state.productOfInterest.filter(
305+
(item) => item !== 'Data API (beta)',
306+
),
307+
});
308+
} else {
309+
this.setState({
310+
productOfInterest: [...this.state.productOfInterest, 'Data API (beta)'],
311+
});
312+
}
289313
}}
290314
/>
291-
</InputRow> */}
315+
</InputRow>
292316
<InputRow>
293317
<Input
294318
name="usageDescription"
295-
label="How do you plan to use our products?"
319+
label="How do you plan to use our products? Is there anything else you’d like to discuss?"
296320
type="textarea"
297321
value={this.state.usageDescription}
298322
required={false}
@@ -385,6 +409,7 @@ export class ModalContact extends React.Component<Props> {
385409
usageDescription,
386410
referral,
387411
isApiKeyRequired,
412+
productOfInterest,
388413
} = this.state;
389414

390415
const body = {
@@ -403,6 +428,7 @@ export class ModalContact extends React.Component<Props> {
403428
usageDescription,
404429
referral,
405430
isApiKeyRequired: `${isApiKeyRequired}`,
431+
productOfInterest: productOfInterest.join(','),
406432
};
407433

408434
await fetch('/api/contact', {

0 commit comments

Comments
 (0)