Skip to content

Commit ee8e2be

Browse files
authored
Merge branch 'yash/ocr-contracts-integration' into 06-16-_tool-4689_dashboard_integrate_erc20asset_contract_in_token_creation_flow
2 parents 3e45e9d + f38c5f9 commit ee8e2be

File tree

1,283 files changed

+26926
-10815
lines changed

Some content is hidden

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

1,283 files changed

+26926
-10815
lines changed

.changeset/loud-clocks-begin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
update nebula ratelimit type

.changeset/ninety-heads-work.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
update error response url

apps/dashboard/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ NEXT_PUBLIC_TYPESENSE_CONTRACT_API_KEY=
3737

3838
# posthog API key
3939
# - not required for prod/staging
40-
NEXT_PUBLIC_POSTHOG_API_KEY="ignored"
40+
NEXT_PUBLIC_POSTHOG_KEY=""
4141

4242
# Stripe Customer portal
4343
NEXT_PUBLIC_STRIPE_KEY=

apps/dashboard/framer-rewrites.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = [
99
// -- build category
1010
"/wallets",
1111
"/account-abstraction",
12-
"/universal-bridge",
12+
"/payments",
1313
"/auth",
1414
"/in-app-wallets",
1515
"/transactions",

apps/dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"papaparse": "^5.5.3",
5656
"pluralize": "^8.0.0",
5757
"posthog-js": "1.256.1",
58+
"posthog-node": "^5.4.0",
5859
"prettier": "3.6.2",
5960
"qrcode": "^1.5.3",
6061
"react": "19.1.0",

apps/dashboard/redirects.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ async function redirects() {
416416
source: "/connect/account-abstraction",
417417
},
418418
{
419-
destination: "/universal-bridge",
419+
destination: "/payments",
420420
permanent: false,
421421
source: "/connect/universal-bridge",
422422
},
@@ -440,6 +440,11 @@ async function redirects() {
440440
permanent: false,
441441
source: "/rpc-edge",
442442
},
443+
{
444+
destination: "/payments",
445+
permanent: false,
446+
source: "/universal-bridge",
447+
},
443448
...legacyDashboardToTeamRedirects,
444449
...projectPageRedirects,
445450
...teamPageRedirects,

apps/dashboard/src/app/(app)/login/auth-actions.ts renamed to apps/dashboard/src/@/actions/auth-actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
1212
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
1313
import { API_SERVER_SECRET } from "@/constants/server-envs";
1414
import { isVercel } from "@/utils/vercel";
15-
import { verifyTurnstileToken } from "./verifyTurnstileToken";
15+
import { verifyTurnstileToken } from "../../app/login/verifyTurnstileToken";
1616

1717
export async function getLoginPayload(
1818
params: GenerateLoginPayloadParams,
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import "server-only";
2+
import { unstable_cache } from "next/cache";
3+
import { PostHog } from "posthog-node";
4+
5+
let _posthogClient: PostHog | null = null;
6+
7+
function getPostHogServer(): PostHog | null {
8+
if (!_posthogClient && process.env.NEXT_PUBLIC_POSTHOG_KEY) {
9+
_posthogClient = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
10+
host: "https://us.i.posthog.com",
11+
});
12+
}
13+
return _posthogClient;
14+
}
15+
16+
/**
17+
* Check if a feature flag is enabled for a specific user
18+
* @param flagKey - The feature flag key
19+
* @param userEmail - The user's email address for filtering
20+
*/
21+
export const isFeatureFlagEnabled = unstable_cache(
22+
async (params: {
23+
flagKey: string;
24+
accountId: string;
25+
email: string | undefined;
26+
}): Promise<boolean> => {
27+
const posthogClient = getPostHogServer();
28+
if (!posthogClient) {
29+
console.warn("Posthog client not set");
30+
return true;
31+
}
32+
33+
const { flagKey, accountId, email } = params;
34+
35+
try {
36+
if (posthogClient && accountId) {
37+
const isEnabled = await posthogClient.isFeatureEnabled(
38+
flagKey,
39+
accountId,
40+
{
41+
personProperties: email ? { email } : undefined,
42+
},
43+
);
44+
if (isEnabled !== undefined) {
45+
return isEnabled;
46+
}
47+
}
48+
} catch (error) {
49+
console.error(`Error checking feature flag ${flagKey}:`, error);
50+
}
51+
return false;
52+
},
53+
["is-feature-flag-enabled"],
54+
{
55+
revalidate: 3600, // 1 hour
56+
},
57+
);

apps/dashboard/src/@/api/analytics.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import type {
1212
UserOpStats,
1313
WalletStats,
1414
WalletUserStats,
15+
WebhookLatencyStats,
16+
WebhookRequestStats,
17+
WebhookSummaryStats,
1518
} from "@/types/analytics";
1619
import { getAuthToken } from "./auth-token";
1720
import { getChains } from "./chain";
@@ -482,6 +485,60 @@ export async function getEngineCloudMethodUsage(
482485
return json.data as EngineCloudStats[];
483486
}
484487

488+
export async function getWebhookSummary(
489+
params: AnalyticsQueryParams & { webhookId: string },
490+
): Promise<{ data: WebhookSummaryStats[] } | { error: string }> {
491+
const searchParams = buildSearchParams(params);
492+
searchParams.append("webhookId", params.webhookId);
493+
494+
const res = await fetchAnalytics(
495+
`v2/webhook/summary?${searchParams.toString()}`,
496+
);
497+
if (!res.ok) {
498+
const reason = await res.text();
499+
return { error: reason };
500+
}
501+
502+
return (await res.json()) as { data: WebhookSummaryStats[] };
503+
}
504+
505+
export async function getWebhookRequests(
506+
params: AnalyticsQueryParams & { webhookId?: string },
507+
): Promise<{ data: WebhookRequestStats[] } | { error: string }> {
508+
const searchParams = buildSearchParams(params);
509+
if (params.webhookId) {
510+
searchParams.append("webhookId", params.webhookId);
511+
}
512+
513+
const res = await fetchAnalytics(
514+
`v2/webhook/requests?${searchParams.toString()}`,
515+
);
516+
if (!res.ok) {
517+
const reason = await res.text();
518+
return { error: reason };
519+
}
520+
521+
return (await res.json()) as { data: WebhookRequestStats[] };
522+
}
523+
524+
export async function getWebhookLatency(
525+
params: AnalyticsQueryParams & { webhookId?: string },
526+
): Promise<{ data: WebhookLatencyStats[] } | { error: string }> {
527+
const searchParams = buildSearchParams(params);
528+
if (params.webhookId) {
529+
searchParams.append("webhookId", params.webhookId);
530+
}
531+
const res = await fetchAnalytics(
532+
`v2/webhook/latency?${searchParams.toString()}`,
533+
);
534+
if (!res.ok) {
535+
const reason = await res.text();
536+
return { error: reason };
537+
}
538+
539+
return (await res.json()) as { data: WebhookLatencyStats[] };
540+
}
541+
485542
export async function getInsightChainUsage(
486543
params: AnalyticsQueryParams,
487544
): Promise<{ data: InsightChainStats[] } | { errorMessage: string }> {

0 commit comments

Comments
 (0)