From 36bfd9ac56521544bea670df7853599d69f52d23 Mon Sep 17 00:00:00 2001 From: Kilian <19181985+kilrau@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:30:53 +0100 Subject: [PATCH 1/4] feat: add chatwoot, replace discord as main help link --- README.md | 2 +- src/chatwoot.ts | 40 +++++++++++++++++++++++++++++++++++++++ src/components/Footer.tsx | 14 ++++---------- src/components/Nav.tsx | 2 +- src/config.ts | 2 ++ src/i18n/i18n.ts | 12 ++++++------ src/index.tsx | 2 ++ src/pages/Pay.tsx | 2 +- 8 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 src/chatwoot.ts diff --git a/README.md b/README.md index f6f0628d..39fac208 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ We encourage our technical users to check the code and run the web app locally f ## Resources -* Get Help: [Discord](https://discord.gg/QBvZGcW) | [Telegram](https://t.me/boltzhq) +* Get Help: [Support Center](https://support.boltz.exchange/hc/center/) | [Discord](https://discord.gg/QBvZGcW) | [Telegram](https://t.me/boltzhq) * Read the Docs: [Docs Home](https://docs.boltz.exchange/) * Read our Blog: [Substack](https://blog.boltz.exchange/) * Follow us: [X/Twitter](https://twitter.com/Boltzhq) | [Nostr](https://snort.social/p/npub1psm37hke2pmxzdzraqe3cjmqs28dv77da74pdx8mtn5a0vegtlas9q8970) diff --git a/src/chatwoot.ts b/src/chatwoot.ts new file mode 100644 index 00000000..cac0aabc --- /dev/null +++ b/src/chatwoot.ts @@ -0,0 +1,40 @@ +import { config } from "./config"; +import { usePayContext } from "./context/Pay"; +import { createEffect, onMount } from "solid-js"; + +export default function Chatwoot() { + onMount(() => { + const token = import.meta.env.VITE_CHATWOOT_TOKEN; + const url = config.chatwootUrl; + if (token !== undefined && url !== undefined) { + const tag = "script"; + const script = document.createElement(tag); + const parent = document.getElementsByTagName(tag)[0]; + script.src = url + "/packs/js/sdk.js"; + script.defer = true; + script.async = true; + parent.parentNode.insertBefore(script, parent); + script.onload = function() { + window.chatwootSettings = { + darkMode: "auto" + }; + window.chatwootSDK.run({ + websiteToken: token, + baseUrl: url + }); + }; + } + }); + + const { swap } = usePayContext(); + + createEffect(() => { + if (swap() !== null) { + window.$chatwoot.setCustomAttributes({ + swapId: swap().id + }); + } + }); + + return ""; +} \ No newline at end of file diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 6c53beab..6abdbd58 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -17,16 +17,6 @@ const Footer = () => { return (