Skip to content

Commit 5694742

Browse files
committed
add projectId parameter to pay analytics components
1 parent 880148b commit 5694742

File tree

13 files changed

+139
-3
lines changed

13 files changed

+139
-3
lines changed

apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/pay/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ export default async function Page(props: {
1717
notFound();
1818
}
1919

20-
return <PayAnalytics clientId={project.publishableKey} />;
20+
return (
21+
<PayAnalytics clientId={project.publishableKey} projectId={project.id} />
22+
);
2123
}

apps/dashboard/src/components/pay/PayAnalytics/PayAnalytics.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@ import { Payouts } from "./components/Payouts";
1414
import { TotalPayVolume } from "./components/TotalPayVolume";
1515
import { TotalVolumePieChart } from "./components/TotalVolumePieChart";
1616

17-
export function PayAnalytics(props: { clientId: string }) {
17+
export function PayAnalytics(props: {
18+
/**
19+
* @deprecated - remove after migration
20+
*/
21+
clientId: string;
22+
// switching to projectId for lookup, but have to send both during migration
23+
projectId: string;
24+
}) {
1825
const clientId = props.clientId;
26+
const projectId = props.projectId;
1927
const [range, setRange] = useState<Range>(() =>
2028
getLastNDaysRange("last-120"),
2129
);
@@ -34,12 +42,14 @@ export function PayAnalytics(props: { clientId: string }) {
3442
<div className="flex items-center border-border border-b pb-6 xl:border-none xl:pb-0">
3543
<TotalVolumePieChart
3644
clientId={clientId}
45+
projectId={projectId}
3746
from={range.from}
3847
to={range.to}
3948
/>
4049
</div>
4150
<TotalPayVolume
4251
clientId={clientId}
52+
projectId={projectId}
4353
from={range.from}
4454
to={range.to}
4555
numberOfDays={numberOfDays}
@@ -50,6 +60,7 @@ export function PayAnalytics(props: { clientId: string }) {
5060
<CardContainer>
5161
<Payouts
5262
clientId={clientId}
63+
projectId={projectId}
5364
from={range.from}
5465
to={range.to}
5566
numberOfDays={numberOfDays}
@@ -58,6 +69,7 @@ export function PayAnalytics(props: { clientId: string }) {
5869
<CardContainer>
5970
<PaymentsSuccessRate
6071
clientId={clientId}
72+
projectId={projectId}
6173
from={range.from}
6274
to={range.to}
6375
/>
@@ -68,20 +80,27 @@ export function PayAnalytics(props: { clientId: string }) {
6880
<div className="border-border border-b pb-6 xl:border-none xl:pb-0">
6981
<PayNewCustomers
7082
clientId={clientId}
83+
projectId={projectId}
7184
from={range.from}
7285
to={range.to}
7386
numberOfDays={numberOfDays}
7487
/>
7588
</div>
7689
<PayCustomersTable
7790
clientId={clientId}
91+
projectId={projectId}
7892
from={range.from}
7993
to={range.to}
8094
/>
8195
</GridWithSeparator>
8296

8397
<CardContainer>
84-
<PaymentHistory clientId={clientId} from={range.from} to={range.to} />
98+
<PaymentHistory
99+
clientId={clientId}
100+
projectId={projectId}
101+
from={range.from}
102+
to={range.to}
103+
/>
85104
</CardContainer>
86105
</div>
87106
</div>

apps/dashboard/src/components/pay/PayAnalytics/components/PayCustomersTable.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ function processQuery(
7171
}
7272

7373
export function PayCustomersTable(props: {
74+
/**
75+
* @deprecated - remove after migration
76+
*/
7477
clientId: string;
78+
// switching to projectId for lookup, but have to send both during migration
79+
projectId: string;
7580
from: Date;
7681
to: Date;
7782
}) {
@@ -80,7 +85,12 @@ export function PayCustomersTable(props: {
8085
);
8186

8287
const topCustomersQuery = usePayCustomers({
88+
/**
89+
* @deprecated - remove after migration
90+
*/
8391
clientId: props.clientId,
92+
// switching to projectId for lookup, but have to send both during migration
93+
projectId: props.projectId,
8494
from: props.from,
8595
to: props.to,
8696
pageSize: 100,

apps/dashboard/src/components/pay/PayAnalytics/components/PayNewCustomers.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ function processQuery(
6969
}
7070

7171
export function PayNewCustomers(props: {
72+
/**
73+
* @deprecated - remove after migration
74+
*/
7275
clientId: string;
76+
// switching to projectId for lookup, but have to send both during migration
77+
projectId: string;
7378
from: Date;
7479
to: Date;
7580
numberOfDays: number;
@@ -86,7 +91,12 @@ export function PayNewCustomers(props: {
8691

8792
const uiQuery = processQuery(
8893
usePayNewCustomers({
94+
/**
95+
* @deprecated - remove after migration
96+
*/
8997
clientId: props.clientId,
98+
// switching to projectId for lookup, but have to send both during migration
99+
projectId: props.projectId,
90100
from: props.from,
91101
to: props.to,
92102
intervalType,

apps/dashboard/src/components/pay/PayAnalytics/components/PaymentHistory.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,24 @@ function processQuery(
6363
}
6464

6565
export function PaymentHistory(props: {
66+
/**
67+
* @deprecated - remove after migration
68+
*/
6669
clientId: string;
70+
// switching to projectId for lookup, but have to send both during migration
71+
projectId: string;
6772
from: Date;
6873
to: Date;
6974
}) {
7075
const [page, setPage] = useState(1);
7176

7277
const purchasesQuery = usePayPurchases({
78+
/**
79+
* @deprecated - remove after migration
80+
*/
7381
clientId: props.clientId,
82+
// switching to projectId for lookup, but have to send both during migration
83+
projectId: props.projectId,
7484
from: props.from,
7585
to: props.to,
7686
start: (page - 1) * pageSize,
@@ -88,7 +98,12 @@ export function PaymentHistory(props: {
8898
fileName="transaction_history"
8999
getData={async () => {
90100
const purchaseData = await getPayPurchases({
101+
/**
102+
* @deprecated - remove after migration
103+
*/
91104
clientId: props.clientId,
105+
// switching to projectId for lookup, but have to send both during migration
106+
projectId: props.projectId,
92107
count: 10000,
93108
from: props.from,
94109
start: 0,

apps/dashboard/src/components/pay/PayAnalytics/components/PaymentsSuccessRate.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,25 @@ function processQuery(
8989
}
9090

9191
export function PaymentsSuccessRate(props: {
92+
/**
93+
* @deprecated - remove after migration
94+
*/
9295
clientId: string;
96+
// switching to projectId for lookup, but have to send both during migration
97+
projectId: string;
9398
from: Date;
9499
to: Date;
95100
}) {
96101
const [type, setType] = useState<PayVolumeType>("all");
97102

98103
const uiQuery = processQuery(
99104
usePayVolume({
105+
/**
106+
* @deprecated - remove after migration
107+
*/
100108
clientId: props.clientId,
109+
// switching to projectId for lookup, but have to send both during migration
110+
projectId: props.projectId,
101111
from: props.from,
102112
to: props.to,
103113
intervalType: "day",

apps/dashboard/src/components/pay/PayAnalytics/components/Payouts.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ function processQuery(query: ReturnType<typeof usePayVolume>): ProcessedQuery {
6565
}
6666

6767
export function Payouts(props: {
68+
/**
69+
* @deprecated - remove after migration
70+
*/
6871
clientId: string;
72+
// switching to projectId for lookup, but have to send both during migration
73+
projectId: string;
6974
from: Date;
7075
to: Date;
7176
numberOfDays: number;
@@ -82,7 +87,12 @@ export function Payouts(props: {
8287

8388
const uiQuery = processQuery(
8489
usePayVolume({
90+
/**
91+
* @deprecated - remove after migration
92+
*/
8593
clientId: props.clientId,
94+
// switching to projectId for lookup, but have to send both during migration
95+
projectId: props.projectId,
8696
from: props.from,
8797
to: props.to,
8898
intervalType,

apps/dashboard/src/components/pay/PayAnalytics/components/TotalPayVolume.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ function processQuery(
5454
}
5555

5656
export function TotalPayVolume(props: {
57+
/**
58+
* @deprecated - remove after migration
59+
*/
5760
clientId: string;
61+
// switching to projectId for lookup, but have to send both during migration
62+
projectId: string;
5863
from: Date;
5964
to: Date;
6065
numberOfDays: number;
@@ -71,7 +76,12 @@ export function TotalPayVolume(props: {
7176

7277
const volumeQuery = processQuery(
7378
usePayVolume({
79+
/**
80+
* @deprecated - remove after migration
81+
*/
7482
clientId: props.clientId,
83+
// switching to projectId for lookup, but have to send both during migration
84+
projectId: props.projectId,
7585
from: props.from,
7686
intervalType,
7787
to: props.to,

apps/dashboard/src/components/pay/PayAnalytics/components/TotalVolumePieChart.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,23 @@ function processQuery(
5858
}
5959

6060
export function TotalVolumePieChart(props: {
61+
/**
62+
* @deprecated - remove after migration
63+
*/
6164
clientId: string;
65+
// switching to projectId for lookup, but have to send both during migration
66+
projectId: string;
6267
from: Date;
6368
to: Date;
6469
}) {
6570
const uiQuery = processQuery(
6671
usePayVolume({
72+
/**
73+
* @deprecated - remove after migration
74+
*/
6775
clientId: props.clientId,
76+
// switching to projectId for lookup, but have to send both during migration
77+
projectId: props.projectId,
6878
from: props.from,
6979
intervalType: "day",
7080
to: props.to,

apps/dashboard/src/components/pay/PayAnalytics/hooks/usePayCustomers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ type Response = {
1717
};
1818

1919
export function usePayCustomers(options: {
20+
/**
21+
* @deprecated - remove after migration
22+
*/
2023
clientId: string;
24+
// switching to projectId for lookup, but have to send both during migration
25+
projectId: string;
2126
from: Date;
2227
to: Date;
2328
pageSize: number;
@@ -40,7 +45,12 @@ export function usePayCustomers(options: {
4045
searchParams: {
4146
skip: `${start}`,
4247
take: `${options.pageSize}`,
48+
/**
49+
* @deprecated - remove after migration
50+
*/
4351
clientId: options.clientId,
52+
// switching to projectId for lookup, but have to send both during migration
53+
projectId: options.projectId,
4454
fromDate: `${options.from.getTime()}`,
4555
toDate: `${options.to.getTime()}`,
4656
},

0 commit comments

Comments
 (0)