Skip to content

Commit c93d5fe

Browse files
authored
Merge branch 'main' into ru-locale
2 parents efff8c6 + cbb1569 commit c93d5fe

File tree

55 files changed

+377
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+377
-245
lines changed

.changeset/neat-wasps-count.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix bytecode caching

apps/dashboard/framer-rewrites.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ module.exports = [
4949
"/templates/:template_slug",
5050
// -- learn --
5151
"/learn",
52-
"/learn/tutorials",
53-
"/learn/tutorials/:tutorial_slug",
5452
"/learn/guides",
5553
"/learn/guides/:guide_slug",
5654
"/learn/courses",
5755
"/learn/glossary",
56+
"/learn/glossary/:glossary_slug",
5857
// -- faucets --
5958
"/faucets",
6059
];

apps/dashboard/redirects.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,19 @@ async function redirects() {
361361
"/team/:team_slug/:project_slug/connect/universal-bridge/:path*",
362362
permanent: false,
363363
},
364+
365+
// all /learn/tutorials (and sub-routes) -> /learn/guides
366+
{
367+
source: "/learn/tutorials/:path*",
368+
destination: "/learn/guides/:path*",
369+
permanent: false,
370+
},
371+
{
372+
source: "/learn/tutorials",
373+
destination: "/learn/guides",
374+
permanent: false,
375+
},
376+
364377
...legacyDashboardToTeamRedirects,
365378
];
366379
}

apps/dashboard/src/app/components/root-providers.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

apps/dashboard/src/app/layout.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import NextTopLoader from "nextjs-toploader";
88
import { Suspense } from "react";
99
import { OpCreditsGrantedModalWrapperServer } from "../components/onboarding/OpCreditsGrantedModalWrapperServer";
1010
import { PosthogIdentifierServer } from "../components/wallets/PosthogIdentifierServer";
11+
import { PHProvider } from "../lib/posthog/Posthog";
12+
import { PosthogHeadSetup } from "../lib/posthog/PosthogHeadSetup";
13+
import { PostHogPageView } from "../lib/posthog/PosthogPageView";
1114
import { EnsureValidConnectedWalletLoginServer } from "./components/EnsureValidConnectedWalletLogin/EnsureValidConnectedWalletLoginServer";
12-
import { PostHogProvider } from "./components/root-providers";
1315
import { AppRouterProviders } from "./providers";
1416

1517
const fontSans = Inter({
@@ -63,8 +65,10 @@ export default function RootLayout({
6365
customDomain="https://pl.thirdweb.com"
6466
selfHosted
6567
/>
68+
<PosthogHeadSetup />
6669
</head>
67-
<PostHogProvider>
70+
<PHProvider>
71+
<PostHogPageView />
6872
<body
6973
className={cn(
7074
"bg-background font-sans antialiased",
@@ -91,7 +95,7 @@ export default function RootLayout({
9195
showSpinner={false}
9296
/>
9397
</body>
94-
</PostHogProvider>
98+
</PHProvider>
9599
</html>
96100
);
97101
}
Lines changed: 17 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,22 @@
1-
"use client";
2-
3-
import {
4-
Alert,
5-
AlertDescription,
6-
AlertIcon,
7-
AlertTitle,
8-
Flex,
9-
IconButton,
10-
} from "@chakra-ui/react";
11-
import { useLocalStorage } from "hooks/useLocalStorage";
12-
import { XIcon } from "lucide-react";
13-
import { Text, TrackedLink } from "tw-components";
14-
15-
export const SmartWalletsBillingAlert = ({
16-
dismissible = false,
17-
}: {
18-
dismissible?: boolean;
19-
}) => {
20-
const [dismissed, setDismissed] = useLocalStorage(
21-
"dismissed-smart-wallets-billing-alert",
22-
false,
23-
true,
24-
);
25-
26-
if (dismissible && dismissed) {
27-
return true;
28-
}
1+
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
2+
import { TrackedUnderlineLink } from "@/components/ui/tracked-link";
3+
import { CircleAlertIcon } from "lucide-react";
294

5+
export const SmartWalletsBillingAlert = () => {
306
return (
31-
<Alert
32-
status="warning"
33-
borderRadius="md"
34-
as={Flex}
35-
alignItems="start"
36-
justifyContent="space-between"
37-
mb={4}
38-
variant="left-accent"
39-
bg="backgroundCardHighlight"
40-
>
41-
<div className="flex flex-row">
42-
<AlertIcon boxSize={4} mt={1} ml={1} />
43-
<Flex flexDir="column" gap={1} pl={1}>
44-
<AlertTitle>Account Abstraction on Mainnet</AlertTitle>
45-
<AlertDescription>
46-
<Text as="span" pr={1}>
47-
You&apos;ve enabled Account Abstraction for one of your API keys.
48-
<br />
49-
To enable AA on mainnet chains,
50-
</Text>{" "}
51-
<TrackedLink
52-
href="/team/~/~/settings/billing"
53-
category="api_keys"
54-
label="smart_wallets_missing_billing"
55-
fontWeight="medium"
56-
color="blue.500"
57-
>
58-
<Text as="span" color="blue.500">
59-
subscribe to a billing plan.
60-
</Text>
61-
</TrackedLink>
62-
</AlertDescription>
63-
</Flex>
64-
</div>
65-
66-
{dismissible && (
67-
<IconButton
68-
size="xs"
69-
aria-label="Close notice"
70-
icon={<XIcon className="size-4" />}
71-
colorScheme="blackAlpha"
72-
color="white"
73-
variant="ghost"
74-
opacity={0.6}
75-
_hover={{ opacity: 1 }}
76-
onClick={() => setDismissed(true)}
77-
/>
78-
)}
7+
<Alert variant="warning">
8+
<CircleAlertIcon className="size-5" />
9+
<AlertTitle>Account Abstraction on Mainnet</AlertTitle>
10+
<AlertDescription>
11+
To enable AA on mainnet chains,{" "}
12+
<TrackedUnderlineLink
13+
href="/team/~/~/settings/billing"
14+
category="api_keys"
15+
label="smart_wallets_missing_billing"
16+
>
17+
subscribe to a billing plan.
18+
</TrackedUnderlineLink>
19+
</AlertDescription>
7920
</Alert>
8021
);
8122
};

apps/dashboard/src/components/wallets/PosthogIdentifier.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useThirdwebClient } from "@/constants/thirdweb.client";
4-
import posthog from "posthog-js";
4+
import { usePostHog } from "posthog-js/react";
55
import { useEffect } from "react";
66
import {
77
useActiveAccount,
@@ -32,48 +32,49 @@ export const PosthogIdentifierClient: React.FC<{
3232
client,
3333
});
3434
const wallet = useActiveWallet();
35+
const posthog = usePostHog();
3536

3637
// legitimate use-case
3738
// eslint-disable-next-line no-restricted-syntax
3839
useEffect(() => {
39-
if (wallet) {
40+
if (wallet && posthog && posthog.__loaded) {
4041
const connector = walletIdToPHName[wallet.id] || wallet.id;
4142
posthog.register({ connector });
4243
posthog.capture("wallet_connected", { connector });
4344
}
44-
}, [wallet]);
45+
}, [wallet, posthog]);
4546

4647
// legitimate use-case
4748
// eslint-disable-next-line no-restricted-syntax
4849
useEffect(() => {
49-
if (accountAddress) {
50+
if (accountAddress && posthog && posthog.__loaded) {
5051
posthog.identify(accountAddress);
5152
}
52-
}, [accountAddress]);
53+
}, [accountAddress, posthog]);
5354

5455
// eslint-disable-next-line no-restricted-syntax
5556
useEffect(() => {
56-
if (accountId) {
57+
if (accountId && posthog && posthog.__loaded) {
5758
posthog.identify(accountId);
5859
}
59-
}, [accountId]);
60+
}, [accountId, posthog]);
6061

6162
// legitimate use-case
6263
// eslint-disable-next-line no-restricted-syntax
6364
useEffect(() => {
64-
if (chain?.id) {
65+
if (chain?.id && posthog && posthog.__loaded) {
6566
posthog.unregister("network");
6667
posthog.register({ chain_id: chain?.id, ecosystem: "evm" });
6768
}
68-
}, [chain?.id]);
69+
}, [chain?.id, posthog]);
6970

7071
// legitimate use-case
7172
// eslint-disable-next-line no-restricted-syntax
7273
useEffect(() => {
73-
if (balance?.data?.displayValue) {
74+
if (balance?.data?.displayValue && posthog && posthog.__loaded) {
7475
posthog.register({ balance: balance.data.displayValue });
7576
}
76-
}, [balance]);
77+
}, [balance, posthog]);
7778

7879
return null;
7980
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use client";
2+
3+
import { isProd } from "@/constants/env";
4+
import posthog from "posthog-js";
5+
import { PostHogProvider } from "posthog-js/react";
6+
import { useEffect } from "react";
7+
8+
const NEXT_PUBLIC_POSTHOG_API_KEY = process.env.NEXT_PUBLIC_POSTHOG_API_KEY;
9+
10+
export function PHProvider({
11+
children,
12+
}: {
13+
children: React.ReactNode;
14+
}) {
15+
// eslint-disable-next-line no-restricted-syntax
16+
useEffect(() => {
17+
if (NEXT_PUBLIC_POSTHOG_API_KEY && isProd) {
18+
posthog.init(NEXT_PUBLIC_POSTHOG_API_KEY, {
19+
api_host: "https://a.thirdweb.com",
20+
capture_pageview: false,
21+
debug: false,
22+
disable_session_recording: true,
23+
});
24+
}
25+
}, []);
26+
27+
return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
28+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const posthogHost = "https://a.thirdweb.com";
2+
3+
export function PosthogHeadSetup() {
4+
return (
5+
<>
6+
<link rel="preconnect" href={posthogHost} />
7+
<link rel="dns-prefetch" href={posthogHost} />
8+
</>
9+
);
10+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"use client";
2+
3+
import { usePathname, useSearchParams } from "next/navigation";
4+
import { usePostHog } from "posthog-js/react";
5+
import { Suspense, useEffect } from "react";
6+
7+
function PostHogPageViewInner() {
8+
const pathname = usePathname();
9+
const searchParams = useSearchParams();
10+
const posthog = usePostHog();
11+
12+
// eslint-disable-next-line no-restricted-syntax
13+
useEffect(() => {
14+
if (pathname && posthog) {
15+
let url = window.origin + pathname;
16+
if (searchParams.toString()) {
17+
url = `${url}?${searchParams.toString()}`;
18+
}
19+
posthog.capture("$pageview", {
20+
$current_url: url,
21+
});
22+
}
23+
}, [pathname, searchParams, posthog]);
24+
25+
return null;
26+
}
27+
28+
export function PostHogPageView() {
29+
return (
30+
<Suspense fallback={null}>
31+
<PostHogPageViewInner />
32+
</Suspense>
33+
);
34+
}

0 commit comments

Comments
 (0)