Skip to content

Commit 87b54c9

Browse files
committed
fix: client analytics for ecosystem wallet (#5643)
https://linear.app/thirdweb/issue/CNCT-2526/analytics-discrepancy-after-migration-to-ecosystem-wallets This fixes for all queries from Nov onwards. We have to think of a solution to backfill for data stretching before Nov if customers ask for it <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the handling of ecosystem identifiers in the codebase, changing from using `ecosystemId` to `ecosystemSlug` for better clarity and consistency across various components and functions. ### Detailed summary - Changed prop from `ecosystemId` to `ecosystemSlug` in `EcosystemAnalyticsPage`. - Updated `getEcosystemWalletUsage` calls to use `ecosystemSlug` instead of `ecosystemId` in `EcosystemSlugLayout` and `EcosystemAnalyticsPage`. - Adjusted the parameter type in `EcosystemAnalyticsPage` and `getEcosystemWalletUsage` to reflect the new `ecosystemSlug` usage. - Modified the fetch URL in `getEcosystemWalletUsage` to use `ecosystemSlug` for API requests. - Updated error message in `getEcosystemWalletUsage` to specify "ecosystem wallet stats". > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 16e5347 commit 87b54c9

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemAnalyticsPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { getEcosystemWalletUsage } from "data/analytics/wallets/ecosystem";
77
import { EcosystemWalletUsersChartCard } from "./EcosystemWalletUsersChartCard";
88

99
export async function EcosystemAnalyticsPage({
10-
ecosystemId,
10+
ecosystemSlug,
1111
interval,
1212
range,
13-
}: { ecosystemId: string; interval: "day" | "week"; range?: Range }) {
13+
}: { ecosystemSlug: string; interval: "day" | "week"; range?: Range }) {
1414
if (!range) {
1515
range = getLastNDaysRange("last-120");
1616
}
1717

1818
const stats = await getEcosystemWalletUsage({
19-
ecosystemId,
19+
ecosystemSlug,
2020
from: range.from,
2121
to: range.to,
2222
period: interval,

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default async function Page(props: {
2222
const ecosystem = await getEcosystem(params.slug);
2323
return (
2424
<EcosystemAnalyticsPage
25-
ecosystemId={ecosystem.id}
25+
ecosystemSlug={ecosystem.slug}
2626
interval={searchParams.interval || "week"}
2727
range={searchParams.range}
2828
/>

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/EcosystemSlugLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ export async function EcosystemLayoutSlug({
3333
}
3434

3535
const allTimeStatsPromise = getEcosystemWalletUsage({
36-
ecosystemId: ecosystem.id,
36+
ecosystemSlug: ecosystem.slug,
3737
from: new Date(2022, 0, 1),
3838
to: new Date(),
3939
period: "all",
4040
});
4141

4242
const monthlyStatsPromise = getEcosystemWalletUsage({
43-
ecosystemId: ecosystem.id,
43+
ecosystemSlug: ecosystem.slug,
4444
from: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
4545
to: new Date(),
4646
period: "month",

apps/dashboard/src/data/analytics/wallets/ecosystem.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import type { EcosystemWalletStats } from "types/analytics";
22
import { fetchAnalytics } from "../fetch-analytics";
33

44
export async function getEcosystemWalletUsage(args: {
5-
ecosystemId: string;
5+
ecosystemSlug: string;
66
from?: Date;
77
to?: Date;
88
period?: "day" | "week" | "month" | "year" | "all";
99
}) {
10-
const { ecosystemId, from, to, period } = args;
10+
const { ecosystemSlug, from, to, period } = args;
1111

1212
const searchParams = new URLSearchParams();
1313
if (from) {
@@ -20,7 +20,7 @@ export async function getEcosystemWalletUsage(args: {
2020
searchParams.append("period", period);
2121
}
2222
const res = await fetchAnalytics(
23-
`v1/wallets/ecosystem/${ecosystemId}?${searchParams.toString()}`,
23+
`v1/wallets/ecosystem/${ecosystemSlug}?${searchParams.toString()}`,
2424
{
2525
method: "GET",
2626
headers: {
@@ -30,7 +30,7 @@ export async function getEcosystemWalletUsage(args: {
3030
);
3131

3232
if (res?.status !== 200) {
33-
console.error("Failed to fetch in-app wallet stats");
33+
console.error("Failed to fetch ecosystem wallet stats");
3434
return null;
3535
}
3636

0 commit comments

Comments
 (0)