Skip to content

Commit 501f52f

Browse files
feat: Added the Make.com Lead Webhook URL and Added a Yellowish theme to Widget (#1041)
2 parents e99db2b + 98363bd commit 501f52f

File tree

5 files changed

+67
-122
lines changed

5 files changed

+67
-122
lines changed

apps/api/src/app/shared/services/lead.service.ts

Lines changed: 14 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -16,123 +16,24 @@ interface ILeadInformation {
1616
@Injectable()
1717
export class LeadService {
1818
private log = process.env.NODE_ENV === 'local';
19-
private maAccessTokenDate: Date;
20-
private maAccessToken: string;
21-
private crmAccessTokenDate: Date;
22-
private crmAccessToken: string;
23-
24-
private async getMaAccessToken(): Promise<string> {
25-
if (
26-
this.maAccessToken &&
27-
this.maAccessTokenDate &&
28-
new Date().getTime() - this.maAccessTokenDate.getTime() < 3500000
29-
) {
30-
if (this.log) console.log('Using cached ma access token');
31-
32-
// 3500000 = 58 minutes
33-
return this.maAccessToken;
34-
}
35-
if (process.env.LEAD_REFRESH_TOKEN && process.env.LEAD_CLIENT_ID && process.env.LEAD_CLIENT_SECRET) {
36-
// eslint-disable-next-line max-len
37-
const url = `https://accounts.zoho.com/oauth/v2/token?client_id=${process.env.LEAD_CLIENT_ID}&grant_type=refresh_token&client_secret=${process.env.LEAD_CLIENT_SECRET}&refresh_token=${process.env.LEAD_REFRESH_TOKEN}`;
38-
if (this.log) console.log('Lead URL', url);
39-
40-
const response = await axios.post(url);
41-
this.maAccessTokenDate = new Date();
42-
this.maAccessToken = response.data.access_token;
43-
if (this.log) console.log('New access token generated', this.maAccessToken);
44-
45-
return response.data.access_token;
46-
}
47-
48-
return undefined;
49-
}
50-
private async getCRMAccessToken(): Promise<string> {
51-
if (
52-
this.crmAccessToken &&
53-
this.crmAccessTokenDate &&
54-
new Date().getTime() - this.crmAccessTokenDate.getTime() < 3500000
55-
) {
56-
if (this.log) console.log('Using cached crm access token');
57-
58-
// 3500000 = 58 minutes
59-
return this.maAccessToken;
60-
}
61-
if (process.env.CRM_REFRESH_TOKEN && process.env.CRM_CLIENT_ID && process.env.CRM_CLIENT_SECRET) {
62-
// eslint-disable-next-line max-len
63-
const url = `https://accounts.zoho.com/oauth/v2/token?client_id=${process.env.CRM_CLIENT_ID}&grant_type=refresh_token&client_secret=${process.env.CRM_CLIENT_SECRET}&refresh_token=${process.env.CRM_REFRESH_TOKEN}`;
64-
if (this.log) console.log('CRM URL', url);
65-
66-
const response = await axios.post(url);
67-
this.crmAccessTokenDate = new Date();
68-
this.crmAccessToken = response.data.access_token;
69-
if (this.log) console.log('New crm token generated', this.crmAccessToken);
70-
71-
return response.data.access_token;
72-
}
73-
74-
return undefined;
75-
}
76-
77-
public async createLead(data: ILeadInformation): Promise<any> {
78-
const maAccessToken = await this.getMaAccessToken();
79-
if (maAccessToken) {
80-
const leadData = JSON.stringify({
81-
'First Name': data['First Name'],
82-
'Last Name': data['Last Name'],
83-
'Lead Email': data['Lead Email'],
84-
});
85-
// Add Lead to marketing automation
86-
// eslint-disable-next-line max-len
87-
const maUrl = `https://marketingautomation.zoho.com/api/v1/json/listsubscribe?listkey=${process.env.LEAD_LIST_KEY}&leadinfo=${leadData}&topic_id=${process.env.LEAD_TOPIC_ID}`;
88-
if (this.log) console.log(maUrl);
89-
90-
try {
91-
const maResponse = await axios.post(
92-
maUrl,
93-
{},
94-
{
95-
headers: {
96-
Authorization: `Zoho-oauthtoken ${maAccessToken}`,
97-
},
98-
}
99-
);
100-
if (this.log) console.log('Lead created', maResponse.data);
101-
} catch (error) {
102-
captureException(error);
103-
}
104-
}
105-
const crmAccessToken = await this.getCRMAccessToken();
106-
if (crmAccessToken) {
107-
// Add Lead to Zoho CRM
108-
const crmUrl = `https://www.zohoapis.com/crm/v6/Leads`;
109-
if (this.log) console.log(crmUrl);
11019

20+
public async createLead(data: ILeadInformation): Promise<void> {
21+
if (process.env.LEAD_MAKE_WEBHOOK_URL) {
11122
try {
112-
const crmResponse = await axios.post(
113-
crmUrl,
114-
{
115-
data: [
116-
{
117-
Last_Name: data['Last Name'],
118-
First_Name: data['First Name'],
119-
Email: data['Lead Email'],
120-
Lead_Source: data['Lead Source'],
121-
Signup_Method: data['Signup Method'],
122-
Mentioned_Role: data['Mentioned Role'],
123-
Company_Size: [data['Company Size']],
124-
},
125-
],
126-
},
127-
{
128-
headers: {
129-
Authorization: `Zoho-oauthtoken ${crmAccessToken}`,
130-
},
131-
}
132-
);
133-
if (this.log) console.log('CRM LEad created', crmResponse.data);
23+
await axios.post(process.env.LEAD_MAKE_WEBHOOK_URL, {
24+
firstName: data['First Name'],
25+
lastName: data['Last Name'],
26+
email: data['Lead Email'],
27+
signupMethod: data['Signup Method'],
28+
mentionedRole: data['Mentioned Role'],
29+
leadSource: data['Lead Source'],
30+
companySize: data['Company Size'],
31+
createdAt: new Date(),
32+
});
33+
if (this.log) console.log('Lead data sent to Make.com webhook');
13434
} catch (error) {
13535
captureException(error);
36+
console.error('Error sending data to Make.com webhook:', error);
13637
}
13738
}
13839
}

apps/web/config/constants.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ export const HOW_HEARD_ABOUT_US = [
436436
{ value: 'Colleague', label: 'Colleague' },
437437
{ value: 'Linkdin', label: 'Linkdin' },
438438
{ value: 'Invitation', label: 'Invitation' },
439+
{ value: 'AI (ChatGPT, Perplexity, Claude ...)', label: 'AI (ChatGPT, Perplexity, Claude ...)' },
439440
];
440441

441442
export const PLACEHOLDERS = {
@@ -445,7 +446,7 @@ export const PLACEHOLDERS = {
445446
fullName: 'John Doe',
446447
companySize: 'Only me',
447448
role: 'Engineer, Manager, Founder...',
448-
source: 'Google Search, Recommendation...',
449+
source: 'Google Search, AI (ChatGPT, Perplexity, Claude ...), Recommendation...',
449450
about: 'Google Search',
450451
importName: 'Products, Employees, Assets...',
451452
};

apps/web/pages/imports/[id].tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,36 @@ function ImportDetails() {
4848
templateId: router.query.id as string,
4949
});
5050
const { showWidget, isImplerInitiated } = useImpler({
51-
primaryColor: colors.blue,
51+
primaryColor: colors.faintYellow,
5252
templateId: templateData?._id,
5353
projectId: templateData?._projectId,
5454
accessToken: profileInfo?.accessToken,
5555
onUploadComplete: onSpreadsheetImported,
56+
appearance: {
57+
widget: {
58+
backgroundColor: '#1c1917',
59+
},
60+
fontFamily: 'Inter, sans-serif',
61+
borderRadius: '12px',
62+
primaryButtonConfig: {
63+
backgroundColor: '#f59e0b',
64+
textColor: '#1c1917',
65+
hoverBackground: '#fbbf24',
66+
hoverTextColor: '#1c1917',
67+
borderColor: 'transparent',
68+
hoverBorderColor: 'transparent',
69+
buttonShadow: '0 4px 16px rgba(245, 158, 11, 0.4)',
70+
},
71+
secondaryButtonConfig: {
72+
backgroundColor: '#292524',
73+
textColor: '#fcd34d',
74+
hoverBackground: '#3c2d2a',
75+
hoverTextColor: '#fed7aa',
76+
borderColor: '#44403c',
77+
hoverBorderColor: '#f59e0b',
78+
buttonShadow: 'none',
79+
},
80+
},
5681
});
5782
const onImportClick = () => {
5883
track({

apps/widget/src/components/Common/Container/Container.tsx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ export function Container({ children }: PropsWithChildren<{}>) {
586586
SegmentedControl: {
587587
styles: (theme) => ({
588588
root: {
589-
backgroundColor: theme.fn.rgba(theme.colors[theme.primaryColor][5], 0.06),
589+
backgroundColor: 'var(--stepper-background)',
590590
borderRadius: 'var(--border-radius)',
591591
padding: '4px',
592592
border: `1px solid var(--border-color)`,
@@ -596,11 +596,10 @@ export function Container({ children }: PropsWithChildren<{}>) {
596596
borderRadius: 'calc(var(--border-radius) - 2px)',
597597
border: 'none !important',
598598
transition: 'all 0.2s ease',
599-
color: 'var(--text-color) !important',
599+
backgroundColor: 'transparent',
600600

601601
'&:not([data-active])': {
602602
backgroundColor: 'transparent',
603-
color: 'var(--text-color) !important',
604603

605604
'&:hover': {
606605
backgroundColor: isColorDark(backgroundColor)
@@ -611,7 +610,6 @@ export function Container({ children }: PropsWithChildren<{}>) {
611610

612611
'&[data-active]': {
613612
backgroundColor: 'var(--button-primary-background) !important',
614-
color: 'var(--button-primary-color) !important',
615613
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
616614

617615
'&:hover': {
@@ -622,7 +620,6 @@ export function Container({ children }: PropsWithChildren<{}>) {
622620

623621
controlActive: {
624622
backgroundColor: 'var(--button-primary-background) !important',
625-
color: 'var(--button-primary-color) !important',
626623
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
627624
},
628625

@@ -631,16 +628,36 @@ export function Container({ children }: PropsWithChildren<{}>) {
631628
fontSize: theme.fontSizes.sm,
632629
padding: '8px 16px',
633630
transition: 'color 0.2s ease',
634-
color: 'var(--text-color) !important',
631+
// Use secondary text color for inactive labels (more subdued but still visible)
632+
color: 'var(--secondary-text-color) !important',
633+
634+
// Ensure inactive state uses secondary text color
635+
'[data-active="false"] &': {
636+
color: 'var(--secondary-text-color) !important',
637+
},
638+
639+
// Ensure active state uses primary button text color
640+
'[data-active="true"] &': {
641+
color: 'var(--button-primary-color) !important',
642+
},
635643
},
636644

637645
labelActive: {
638646
color: 'var(--button-primary-color) !important',
639647
fontWeight: 600,
640648
},
649+
650+
// Additional selector to ensure proper color inheritance
651+
input: {
652+
'&:not(:checked) + label': {
653+
color: 'var(--secondary-text-color) !important',
654+
},
655+
'&:checked + label': {
656+
color: 'var(--button-primary-color) !important',
657+
},
658+
},
641659
}),
642660
},
643-
644661
FindReplaceModal: {
645662
styles: (theme) => ({
646663
root: {

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ services:
5050
EMAIL_FROM: ${EMAIL_FROM}
5151
EMAIL_FROM_NAME: ${EMAIL_FROM_NAME}
5252
ALERT_EMAIL_FROM: ${ALERT_EMAIL_FROM}
53+
LEAD_MAKE_WEBHOOK_URL: ${LEAD_MAKE_WEBHOOK_URL}
5354
ports:
5455
- "3000:3000"
5556
networks:

0 commit comments

Comments
 (0)