Skip to content

Commit

Permalink
feat: Added formbricks sdk (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Jun 29, 2024
2 parents 3a48447 + 156aedc commit 5d16c84
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 43 deletions.
3 changes: 2 additions & 1 deletion apps/web/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ NEXT_PUBLIC_AMPLITUDE_ID=
NEXT_PUBLIC_TAWK_PROPERTY_ID=
NEXT_PUBLIC_TAWK_WIDGET_ID=
NEXT_PUBLIC_OPENREPLAY_KEY=
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_SENTRY_DSN=
NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID=
8 changes: 8 additions & 0 deletions apps/web/components/common/Support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Script from 'next/script';
import getConfig from 'next/config';
import Tracker from '@openreplay/tracker';
import { useEffect, useRef } from 'react';
import formbricks from '@formbricks/js/app';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import TawkMessengerReact from '@tawk.to/tawk-messenger-react';
Expand Down Expand Up @@ -41,6 +42,13 @@ export function Support({ profile }: SupportProps) {
tracker.setMetadata('lastname', profile.lastName);
tracker.setMetadata('firstname', profile.firstName);
}
if (publicRuntimeConfig.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID) {
formbricks.init({
environmentId: publicRuntimeConfig.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID,
userId: profile._id,
apiHost: 'https://app.formbricks.com',
});
}
/*
* twakRef.current?.setAttributes({
* id: profile._id,
Expand Down
1 change: 1 addition & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const nextConfig = {
NEXT_PUBLIC_ONBOARDING_TOKEN: process.env.NEXT_PUBLIC_ONBOARDING_TOKEN,
NEXT_PUBLIC_PAYMENT_GATEWAY_URL: process.env.NEXT_PUBLIC_PAYMENT_GATEWAY_URL,
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID: process.env.NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID,
NEXT_PUBLIC_COUPON_ENABLED: process.env.NEXT_PUBLIC_COUPON_ENABLED,
},
sentry: {
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@amplitude/analytics-browser": "^2.0.1",
"@emotion/react": "^11.10.5",
"@emotion/server": "^11.10.0",
"@formbricks/js": "^2.1.0",
"@impler/react": "workspace:^",
"@impler/shared": "workspace:^",
"@mantine/carousel": "6.0.21",
Expand Down
1 change: 1 addition & 0 deletions apps/web/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace NodeJS {
NEXT_PUBLIC_TAWK_WIDGET_ID: string;
NEXT_PUBLIC_OPENREPLAY_KEY: string;
NEXT_PUBLIC_SENTRY_DSN: string;
NEXT_PUBLIC_FORMBRICKS_ENVIRONMENT_ID: string;

NEXT_PUBLIC_PAYMENT_GATEWAY_URL: string;
NEXT_PUBLIC_GTM_ID: string;
Expand Down
61 changes: 19 additions & 42 deletions pnpm-lock.yaml

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

0 comments on commit 5d16c84

Please sign in to comment.