File tree Expand file tree Collapse file tree 5 files changed +49
-1
lines changed Expand file tree Collapse file tree 5 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -428,3 +428,31 @@ export function reportUpsellClicked(properties: UpsellParams) {
428
428
export function reportPaymentCardClick ( properties : { id : string } ) {
429
429
posthog . capture ( "payment card clicked" , properties ) ;
430
430
}
431
+
432
+ /**
433
+ * ### Why do we need to report this event?
434
+ * - To track payment link usage
435
+ *
436
+ * ### Who is responsible for this event?
437
+ * @greg
438
+ */
439
+ export function reportPaymentLinkVisited ( properties : {
440
+ linkId : string ;
441
+ clientId : string ;
442
+ } ) {
443
+ posthog . capture ( "payment link visited" , properties ) ;
444
+ }
445
+
446
+ /**
447
+ * ### Why do we need to report this event?
448
+ * - To track payment link usage
449
+ *
450
+ * ### Who is responsible for this event?
451
+ * @greg
452
+ */
453
+ export function reportPaymentLinkCompleted ( properties : {
454
+ linkId : string ;
455
+ clientId : string ;
456
+ } ) {
457
+ posthog . capture ( "payment link completed" , properties ) ;
458
+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import { TableRow } from "./PaymentsTableRow";
19
19
export function RecentPaymentsSection ( props : {
20
20
client : ThirdwebClient ;
21
21
projectClientId : string ;
22
+ teamSlug : string ;
23
+ projectSlug : string ;
22
24
teamId : string ;
23
25
} ) {
24
26
const { data : payPurchaseData , isLoading } = useQuery <
@@ -95,7 +97,10 @@ export function RecentPaymentsSection(props: {
95
97
className = "flex items-center gap-2"
96
98
asChild
97
99
>
98
- < Link href = "/pay" target = "_blank" >
100
+ < Link
101
+ href = { `/team/${ props . teamSlug } /${ props . projectSlug } /payments/links` }
102
+ target = "_blank"
103
+ >
99
104
Create Payment Link
100
105
< ArrowRightIcon className = "size-4" />
101
106
</ Link >
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ export default async function Page(props: {
45
45
client = { client }
46
46
projectClientId = { project . publishableKey }
47
47
teamId = { project . teamId }
48
+ projectSlug = { params . project_slug }
49
+ teamSlug = { params . team_slug }
48
50
/>
49
51
< div className = "h-12" />
50
52
< QuickStartSection
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { Metadata } from "next";
2
2
import { defineChain , getContract } from "thirdweb" ;
3
3
import { getCurrencyMetadata } from "thirdweb/extensions/erc20" ;
4
4
import { checksumAddress } from "thirdweb/utils" ;
5
+ import { reportPaymentLinkVisited } from "@/analytics/report" ;
5
6
import { getPaymentLink } from "@/api/universal-bridge/links" ;
6
7
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client" ;
7
8
import { PayPageWidget } from "../components/client/PayPageWidget.client" ;
@@ -32,6 +33,11 @@ export default async function PayPage({
32
33
paymentId : id ,
33
34
} ) ;
34
35
36
+ reportPaymentLinkVisited ( {
37
+ linkId : id ,
38
+ clientId : paymentLink . clientId ,
39
+ } ) ;
40
+
35
41
const tokenContract = getContract ( {
36
42
address : paymentLink . destinationToken . address , // for this RPC call, use the dashboard client
37
43
// eslint-disable-next-line no-restricted-syntax
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { useEffect } from "react";
5
5
import { createThirdwebClient , NATIVE_TOKEN_ADDRESS , toTokens } from "thirdweb" ;
6
6
import { AutoConnect , CheckoutWidget } from "thirdweb/react" ;
7
7
import { checksumAddress } from "thirdweb/utils" ;
8
+ import { reportPaymentLinkCompleted } from "@/analytics/report" ;
8
9
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter" ;
9
10
10
11
export function PayPageWidget ( {
@@ -60,6 +61,12 @@ export function PayPageWidget({
60
61
onSuccess = { ( ) => {
61
62
if ( ! redirectUri ) return ;
62
63
const url = new URL ( redirectUri ) ;
64
+ if ( paymentLinkId && clientId ) {
65
+ reportPaymentLinkCompleted ( {
66
+ linkId : paymentLinkId ,
67
+ clientId : clientId ,
68
+ } ) ;
69
+ }
63
70
return window . open ( url . toString ( ) ) ;
64
71
} }
65
72
paymentLinkId = { paymentLinkId }
You can’t perform that action at this time.
0 commit comments