Skip to content

Commit

Permalink
Merge pull request #1109 from tailwarden/integrate-formbricks
Browse files Browse the repository at this point in the history
feat: integrate formbricks in-app survey
  • Loading branch information
mlabouardy authored Oct 17, 2023
2 parents ee90608 + 5c5719f commit 89fa3fb
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 121 deletions.
3 changes: 2 additions & 1 deletion dashboard/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const environment = {
: '',
GA_TRACKING_ID: 'G-9HF3HT6S6W',
SENTRY_URL:
'https://b4b98ad60a89468284cf8aa5d66cf2cd@o1267000.ingest.sentry.io/4504797672701952'
'https://b4b98ad60a89468284cf8aa5d66cf2cd@o1267000.ingest.sentry.io/4504797672701952',
FORMBRICKS_ENV_ID: 'clnmmpeg01ci3o50fu5wy89zn'
};

export default environment;
246 changes: 126 additions & 120 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@formbricks/js": "^1.1.2",
"@sentry/react": "^7.41.0",
"@sentry/tracing": "^7.41.0",
"@tippyjs/react": "^4.2.6",
Expand Down
20 changes: 20 additions & 0 deletions dashboard/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import '../styles/globals.css';
import type { AppProps } from 'next/app';
import formbricks from '@formbricks/js';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import Layout from '../components/layout/Layout';
import environment from '../environments/environment';

const printHiringMessage = () => {
// eslint-disable-next-line no-console
Expand All @@ -22,9 +26,25 @@ const printHiringMessage = () => {

if (typeof window !== 'undefined') {
printHiringMessage();
formbricks.init({
environmentId: environment.FORMBRICKS_ENV_ID,
apiHost: 'https://app.formbricks.com',
debug: false // remove when in production
});
}

export default function App({ Component, pageProps }: AppProps) {
const router = useRouter();

useEffect(() => {
// Connect next.js router to Formbricks
const handleRouteChange = formbricks?.registerRouteChange;
router.events.on('routeChangeComplete', handleRouteChange);

return () => {
router.events.off('routeChangeComplete', handleRouteChange);
};
}, []);
return (
<Layout>
<Component {...pageProps} />
Expand Down

0 comments on commit 89fa3fb

Please sign in to comment.