-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing links to contact form (#9945)
* fixing links to contact form * editing links and hubspot form to fix caching issue * fixing linting * removing sales page * linter * fix linter again
- Loading branch information
1 parent
136e2e4
commit 3068af8
Showing
6 changed files
with
66 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
import { useEffect } from "react"; | ||
import React, { useEffect } from "react"; | ||
|
||
declare global { | ||
interface Window { | ||
hbspt?: { | ||
forms: { | ||
create: (config: { | ||
region: string; | ||
portalId: string; | ||
formId: string; | ||
target: string; | ||
}) => void; | ||
}; | ||
}; | ||
} | ||
} | ||
|
||
export default function HubSpotForm() { | ||
useEffect(() => { | ||
// Add script dynamically | ||
const script = document.createElement("script"); | ||
script.src = "https://js-eu1.hsforms.net/forms/embed/144442587.js"; | ||
script.defer = true; | ||
document.body.appendChild(script); | ||
|
||
// Cleanup on unmount | ||
return () => { | ||
document.body.removeChild(script); | ||
const existingScript = document.getElementById("hubspot-script"); | ||
const createForm = () => { | ||
if (window.hbspt && window.hbspt.forms && window.hbspt.forms.create) { | ||
window.hbspt.forms.create({ | ||
region: "eu1", | ||
portalId: "144442587", | ||
formId: "31e790e5-f4d5-4c79-acc5-acd770fe8f84", | ||
target: "#hubspotForm", | ||
}); | ||
} | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<div | ||
className="hs-form-frame" | ||
data-region="eu1" | ||
data-form-id="31e790e5-f4d5-4c79-acc5-acd770fe8f84" | ||
data-portal-id="144442587" | ||
/> | ||
); | ||
if (!existingScript) { | ||
const script = document.createElement("script"); | ||
script.id = "hubspot-script"; | ||
script.src = "https://js-eu1.hsforms.net/forms/v2.js"; | ||
script.defer = true; | ||
script.onload = createForm; | ||
document.body.appendChild(script); | ||
} else { | ||
// If the script is already present, just recreate the form | ||
createForm(); | ||
} | ||
}, []); | ||
return <div id="hubspotForm" />; | ||
} |
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