Skip to content

Commit

Permalink
Revert "Add Cookie Manager and Add CCA Device Tracking" (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-moore-cb authored Jan 29, 2024
1 parent 049b8a1 commit af4f4ae
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 1,100 deletions.
95 changes: 0 additions & 95 deletions apps/base-docs/docs/cookie-policy.mdx

This file was deleted.

2 changes: 0 additions & 2 deletions apps/base-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
"typecheck": "tsc"
},
"dependencies": {
"@coinbase/cookie-banner": "^1.0.3",
"@coinbase/cookie-manager": "^1.1.1",
"@docusaurus/core": "2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@mdx-js/react": "^1.6.22",
Expand Down
1 change: 0 additions & 1 deletion apps/base-docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,5 @@ module.exports = {
},
['terms-of-service'],
['privacy-policy'],
['cookie-policy'],
],
};
21 changes: 0 additions & 21 deletions apps/base-docs/src/components/CookieManager/index.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions apps/base-docs/src/components/CookieManager/styles.module.css

This file was deleted.

3 changes: 2 additions & 1 deletion apps/base-docs/src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
type IconProps = {
name: 'thumbs-up' | 'thumbs-up-filled' | 'thumbs-down' | 'thumbs-down-filled' | 'caret-down';
color?: 'white' | 'black';
width?: string;
height?: string;
};

export default function Icon({ name, width = '24', height = '24' }: IconProps) {
export default function Icon({ name, color = 'white', width = '24', height = '24' }: IconProps) {
if (name === 'thumbs-up') {
return (
<svg
Expand Down
96 changes: 2 additions & 94 deletions apps/base-docs/src/theme/Root.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/* eslint-disable */
import React, { useState, useEffect, useCallback, useRef } from 'react';
import {
connectorsForWallets,
getDefaultWallets,
RainbowKitProvider,
} from '@rainbow-me/rainbowkit';
import { useEffect, useState } from 'react';
import { configureChains, createConfig, WagmiConfig } from 'wagmi';
import { baseGoerli, baseSepolia } from 'wagmi/chains';
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
import { Provider as CookieManagerProvider, Region } from '@coinbase/cookie-manager';
import { cookieManagerConfig } from '../utils/cookieManagerConfig';
import { CookieBanner } from '@coinbase/cookie-banner';

export const { chains, publicClient } = configureChains(
[baseGoerli, baseSepolia],
Expand All @@ -35,101 +32,12 @@ const wagmiConfig = createConfig({
publicClient,
});

const cookieBannerTheme = {
colors: {
primary: '#1652F0',
positive: '#05B169',
negative: '#DF5F67',
warning: '#F4C622',
background: '#FFFFFF',
backgroundMuted: '#EEF0F3',
onBackground: '#050F1A',
onBackgroundMuted: '#0A0B0D',
onPrimary: '#FFFFFF',
overlay: 'rgba(17,52,83,0.6)',
},
border: {
border: '1px solid #D8D8D8',
borderRadius: '4px',
},
fontSize: {
sm: '14px',
md: '16px',
},
fontWeight: {
regular: '400',
bold: '500',
},
size: {
xs: '8px',
sm: '16px',
md: '24px',
lg: '32px',
},
breakpoints: {
phone: 560,
desktop: 992,
tablet: 768,
},
zIndex: {
high: 2,
overlay: 1000,
},
};

export default function Root({ children }) {
const [mounted, setMounted] = useState(false);

// Cookie Consent Manager Provider Configuration
const trackingPreference = useRef();

const setTrackingPreference = useCallback((newPreference) => {
const priorConsent = trackingPreference.current?.consent;
trackingPreference.current = newPreference;

if (!priorConsent) {
// The first time the modal appears, this function is called with nothing present in
// trackingPreference.current. To avoid an infinite refresh loop, we return early on
// the first call.
return;
}

const newConsent = newPreference.consent;

// Check if the preferences have changed.
const diff = [
...priorConsent.filter((elem) => !newConsent.includes(elem)),
...newConsent.filter((elem) => !priorConsent.includes(elem)),
];

// Reload if the preferences have changed.
if (diff.length > 0) {
window.location.reload();
}
}, []);

const handleLogError = useCallback((err) => console.error(err), []);

useEffect(() => setMounted(true), []);

if (!mounted) return null;

return (
<WagmiConfig config={wagmiConfig}>
<RainbowKitProvider chains={chains}>
<CookieManagerProvider
projectName="base_docs"
locale="en"
region={Region.DEFAULT}
log={console.log}
onError={handleLogError}
onPreferenceChange={setTrackingPreference}
config={cookieManagerConfig}
>
{children}
<CookieBanner companyName="Base" link="/cookie-policy" theme={cookieBannerTheme} />
</CookieManagerProvider>
</RainbowKitProvider>
<RainbowKitProvider chains={chains}>{children}</RainbowKitProvider>
</WagmiConfig>
);
}
42 changes: 0 additions & 42 deletions apps/base-docs/src/utils/cookieManagement.ts

This file was deleted.

42 changes: 0 additions & 42 deletions apps/base-docs/src/utils/cookieManagerConfig.ts

This file was deleted.

Loading

0 comments on commit af4f4ae

Please sign in to comment.