use latest openpanel/nextjs package (1.0.0)

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-08-09 23:09:04 +02:00
parent 0069ae60c7
commit ac9cbae138
8 changed files with 29 additions and 76 deletions

View File

@@ -5,9 +5,10 @@ import { pushModal, useOnPushModal } from '@/modals';
import { useUser } from '@clerk/nextjs';
import { differenceInDays } from 'date-fns';
import { trackEvent } from '@openpanel/nextjs';
import { useOpenPanel } from '@openpanel/nextjs';
export default function SideEffects() {
const op = useOpenPanel();
const { user } = useUser();
const accountAgeInDays = differenceInDays(
new Date(),
@@ -30,7 +31,7 @@ export default function SideEffects() {
useEffect(() => {
if (showTestimonial) {
pushModal('Testimonial');
trackEvent('testimonials_shown');
op.track('testimonials_shown');
}
}, [showTestimonial]);

View File

@@ -14,7 +14,7 @@ import { Provider as ReduxProvider } from 'react-redux';
import { Toaster } from 'sonner';
import superjson from 'superjson';
import { OpenpanelProvider } from '@openpanel/nextjs';
import { OpenPanelComponent } from '@openpanel/nextjs';
function AllProviders({ children }: { children: React.ReactNode }) {
const { userId, getToken } = useAuth();
@@ -63,9 +63,10 @@ function AllProviders({ children }: { children: React.ReactNode }) {
disableTransitionOnChange
>
{process.env.NEXT_PUBLIC_OP_CLIENT_ID && (
<OpenpanelProvider
<OpenPanelComponent
clientId={process.env.NEXT_PUBLIC_OP_CLIENT_ID}
profileId={userId || undefined}
waitForProfile
trackScreenViews
trackOutgoingLinks
/>