@@ -16,6 +16,7 @@ import {
1616 useState ,
1717} from 'react' ;
1818import { Environment } from '@imtbl/config' ;
19+ import { trackError } from '@imtbl/metrics' ;
1920import { ConnectLoaderState } from '../../../context/connect-loader-context/ConnectLoaderContext' ;
2021import { SaleWidgetViews } from '../../../context/view-context/SaleViewContextTypes' ;
2122import {
@@ -88,7 +89,7 @@ type SaleContextValues = SaleContextProps & {
8889 paymentMethod ?: SalePaymentTypes | undefined ,
8990 data ?: Record < string , unknown >
9091 ) => void ;
91- goToErrorView : ( type : SaleErrorTypes , data ?: Record < string , unknown > ) => void ;
92+ goToErrorView : ( type : SaleErrorTypes , data ?: Record < string , string > ) => void ;
9293 goToSuccessView : ( data ?: Record < string , unknown > ) => void ;
9394 fundingRoutes : FundingRoute [ ] ;
9495 disabledPaymentTypes : SalePaymentTypes [ ] ;
@@ -306,13 +307,15 @@ export function SaleContextProvider(props: {
306307 ) ;
307308
308309 const goToErrorView = useCallback (
309- ( errorType : SaleErrorTypes , data : Record < string , unknown > = { } ) => {
310+ ( errorType : SaleErrorTypes , data : Record < string , string > = { } ) => {
310311 errorRetries . current += 1 ;
311312 if ( errorRetries . current > MAX_ERROR_RETRIES ) {
312313 errorRetries . current = 0 ;
313314 setPaymentMethod ( undefined ) ;
314315 }
315316
317+ trackError ( 'commerce' , 'saleError' , new Error ( errorType ) , data ) ;
318+
316319 viewDispatch ( {
317320 payload : {
318321 type : ViewActions . UPDATE_VIEW ,
0 commit comments