chore: add affonso script to layout
This commit is contained in:
parent
3ea18fcade
commit
ce7978a572
@ -1,9 +1,12 @@
|
||||
import { Analytics } from '@/analytics/analytics';
|
||||
import {
|
||||
fontBricolageGrotesque,
|
||||
fontNotoSans,
|
||||
fontNotoSansMono,
|
||||
fontNotoSerif,
|
||||
} from '@/assets/fonts';
|
||||
import { AffonsoScript } from '@/components/affiliate/affonso';
|
||||
import { TailwindIndicator } from '@/components/layout/tailwind-indicator';
|
||||
import { routing } from '@/i18n/routing';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { type Locale, NextIntlClientProvider, hasLocale } from 'next-intl';
|
||||
@ -13,8 +16,6 @@ import { Toaster } from 'sonner';
|
||||
import { Providers } from './providers';
|
||||
|
||||
import '@/styles/globals.css';
|
||||
import { Analytics } from '@/analytics/analytics';
|
||||
import { TailwindIndicator } from '@/components/layout/tailwind-indicator';
|
||||
|
||||
interface LocaleLayoutProps {
|
||||
children: ReactNode;
|
||||
@ -41,6 +42,9 @@ export default async function LocaleLayout({
|
||||
|
||||
return (
|
||||
<html suppressHydrationWarning lang={locale}>
|
||||
<head>
|
||||
<AffonsoScript />
|
||||
</head>
|
||||
<body
|
||||
suppressHydrationWarning
|
||||
className={cn(
|
||||
|
33
src/components/affiliate/affonso.tsx
Normal file
33
src/components/affiliate/affonso.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
'use client';
|
||||
|
||||
import { websiteConfig } from '@/config/website';
|
||||
import Script from 'next/script';
|
||||
|
||||
/**
|
||||
* Affonso Affiliate
|
||||
*
|
||||
* https://affonso.com
|
||||
*/
|
||||
export function AffonsoScript() {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!websiteConfig.features.enableAffonsoAffiliate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const affiliateId = process.env.NEXT_PUBLIC_AFFILIATE_AFFONSO_ID as string;
|
||||
if (!affiliateId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Script
|
||||
src="https://affonso.io/js/pixel.min.js"
|
||||
strategy="afterInteractive"
|
||||
data-affonso={affiliateId}
|
||||
data-cookie_duration="30"
|
||||
/>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user