@@ -10,19 +10,21 @@ import CheckedAnimation from './CheckedAnimation';
1010
1111export interface OrderDetailsProps {
1212 orderId : number | string ;
13- transactionId : number | string ;
13+ transactionId ? : number | string | null ;
1414}
1515
1616const OrderDetails : FC < OrderDetailsProps > = ( { orderId, transactionId } ) => {
1717 const t = useTranslations ( ) ;
1818
1919 const handleClickOnCopy = ( ) => {
20- navigator . clipboard
21- . writeText ( transactionId . toString ( ) )
22- . then ( ( ) => {
23- toast . success ( t ( 'messages.copied' ) ) ;
24- } )
25- . catch ( ( err ) => { } ) ;
20+ if ( transactionId ) {
21+ navigator . clipboard
22+ . writeText ( transactionId . toString ( ) )
23+ . then ( ( ) => {
24+ toast . success ( t ( 'messages.copied' ) ) ;
25+ } )
26+ . catch ( ( err ) => { } ) ;
27+ }
2628 } ;
2729
2830 return (
@@ -42,18 +44,22 @@ const OrderDetails: FC<OrderDetailsProps> = ({ orderId, transactionId }) => {
4244 { t ( 'order.payment.successful.description' ) }
4345 </ Typography >
4446
45- < Stack direction = "row" alignItems = "center" spacing = { 1 } >
46- < Typography variant = "body2" color = "textSecondary" gutterBottom >
47- { t ( 'order.payment.successful.transactionId' ) } { ' ' }
48- </ Typography >
49- < Button
50- onClick = { handleClickOnCopy }
51- variant = "outlined"
52- endIcon = { < ContentCopyOutlined fontSize = "small" /> }
53- >
54- < Typography variant = "h6" > { transactionId } </ Typography >
55- </ Button >
56- </ Stack >
47+ { ! ! transactionId && (
48+ < Stack direction = "row" alignItems = "center" spacing = { 1 } >
49+ < Typography variant = "body2" color = "textSecondary" gutterBottom >
50+ { t ( 'order.payment.successful.transactionId' ) } { ' ' }
51+ </ Typography >
52+
53+ < Button
54+ onClick = { handleClickOnCopy }
55+ variant = "outlined"
56+ endIcon = { < ContentCopyOutlined fontSize = "small" /> }
57+ >
58+ < Typography variant = "h6" > { transactionId } </ Typography >
59+ </ Button >
60+ </ Stack >
61+ ) }
62+
5763 < Button
5864 sx = { {
5965 width : 'fit-content' ,
0 commit comments