add help scout support chat for Pro users

This commit is contained in:
Abi Raja 2024-06-05 14:20:37 -04:00
parent 2f260f5442
commit 29978828a4
4 changed files with 46 additions and 2 deletions

View File

@ -16,6 +16,32 @@
<!-- Injected code for hosted version -->
<%- injectHead %>
<!-- Help Scout -->
<script type="text/javascript">
!(function (e, t, n) {
function a() {
var e = t.getElementsByTagName("script")[0],
n = t.createElement("script");
(n.type = "text/javascript"),
(n.async = !0),
(n.src = "https://beacon-v2.helpscout.net"),
e.parentNode.insertBefore(n, e);
}
if (
((e.Beacon = n =
function (t, n, a) {
e.Beacon.readyQueue.push({ method: t, options: n, data: a });
}),
(n.readyQueue = []),
"complete" === t.readyState)
)
return a();
e.attachEvent
? e.attachEvent("onload", a)
: e.addEventListener("load", a, !1);
})(window, document, window.Beacon || function () {});
</script>
<title>Screenshot to Code</title>
<!-- Open Graph Meta Tags -->

View File

@ -6,7 +6,7 @@ export function PicoBadge() {
<div>
<PricingDialog />
</div>
<a
{/* <a
href="https://screenshot-to-code.canny.io/feature-requests"
target="_blank"
>
@ -16,7 +16,7 @@ export function PicoBadge() {
>
feedback
</div>
</a>
</a> */}
</>
);
}

View File

@ -59,6 +59,13 @@ function AppContainer() {
last_name: user.last_name,
});
// Initialize Help Scout Beacon
window.Beacon("init", "8bcd8d6f-f25d-4339-8f49-703b9f165cdc");
window.Beacon("identify", {
name: user.first_name + " " + user.last_name,
email: user.email,
});
setSubscriberTier(user.subscriber_tier);
}

11
frontend/src/help-scout.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
// help-scout.d.ts
type Beacon = (eventName: string, options?: any) => void;
// Extend the Window interface to include the `plausible` function
declare global {
interface Window {
Beacon: Beacon;
}
}
export {};