Skip to content

Commit

Permalink
Consent Custom Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
vietredweb committed Jan 24, 2024
1 parent d89500b commit 0207d54
Show file tree
Hide file tree
Showing 16 changed files with 1,652 additions and 70 deletions.
25 changes: 19 additions & 6 deletions src/AnalyticsNext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,38 @@ import { NextRouter } from 'next/router';
import dynamic from 'next/dynamic';

const ConsentComponent = dynamic(() => import('../Components/Consent'), { ssr: false });
const ConsentComponentCustom = dynamic(() => import('../Components/ConsentCustom'), { ssr: false });

interface AnalyticsNext {
router: NextRouter;
attributes: any;
customLayout: boolean;
children?: ReactNode;
}

const AnalyticsNext = ({ router, attributes, children }: AnalyticsNext) => {
const AnalyticsNext = ({ router, attributes, customLayout = false, children }: AnalyticsNext) => {
console.log('customLayout', customLayout);
return (
<>
<AnalyticsContextProvider>
<AnalyticsHandle router={router} attributes={attributes}>
{children}
{process.env.NEXT_PUBLIC_DISABLE_ANALYTICS_CONSENT !== 'true' && (
<ConsentComponent
endpoint={process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.NEXT_PUBLIC_ENDPOINT_URL ?? 'https://api.aesirx.io'}
/>
<>
{customLayout ? (
<ConsentComponentCustom
endpoint={process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.NEXT_PUBLIC_ENDPOINT_URL ?? 'https://api.aesirx.io'}
/>
) : (
<ConsentComponent
endpoint={process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.NEXT_PUBLIC_ENDPOINT_URL ?? 'https://api.aesirx.io'}
/>
)}
</>
)}
</AnalyticsHandle>
</AnalyticsContextProvider>
Expand Down
5 changes: 5 additions & 0 deletions src/Assets/check_circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/check_line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Assets/checkbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/Assets/checkbox_active.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0207d54

Please sign in to comment.