File tree Expand file tree Collapse file tree 1 file changed +26
-10
lines changed
apps/dashboard/src/app/checkout/components/client Expand file tree Collapse file tree 1 file changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,33 @@ export function CheckoutEmbed({
7575 onPurchaseSuccess : ( result ) => {
7676 if ( ! redirectUri ) return ;
7777 const url = new URL ( redirectUri ) ;
78- if ( result . type === "transaction" ) {
79- url . searchParams . set ( "txHash" , result . transactionHash ) ;
80- return window . open ( url . toString ( ) ) ;
81- }
82- if ( result . status . status === "NOT_FOUND" ) {
83- throw new Error ( "Transaction not found" ) ;
84- }
85- const txHash = result . status . source ?. transactionHash ;
86- if ( typeof txHash === "string" ) {
87- url . searchParams . set ( "txHash" , txHash ) ;
78+ switch ( result . type ) {
79+ case "crypto" : {
80+ url . searchParams . set ( "status" , result . status . status ) ;
81+ if (
82+ "source" in result . status &&
83+ result . status . source ?. transactionHash
84+ ) {
85+ url . searchParams . set (
86+ "txHash" ,
87+ result . status . source ?. transactionHash ,
88+ ) ;
89+ }
90+ break ;
91+ }
92+ case "fiat" : {
93+ url . searchParams . set ( "status" , result . status . status ) ;
94+ if ( "intentId" in result . status ) {
95+ url . searchParams . set ( "intentId" , result . status . intentId ) ;
96+ }
97+ break ;
98+ }
99+ case "transaction" : {
100+ url . searchParams . set ( "txHash" , result . transactionHash ) ;
101+ break ;
102+ }
88103 }
104+ return window . open ( url . toString ( ) ) ;
89105 } ,
90106 } }
91107 />
You can’t perform that action at this time.
0 commit comments