adyen-web
adyen-web copied to clipboard
[FEAT] Add callback types to CoreOptions
Is your feature request related to a problem? Please describe.
Currently none of the callbacks are typed in CoreOptions
.
Describe the solution you'd like
src/core/types.ts
...
/**
* OnLoad callback
*/
onLoad?: (callbackObj: CbObjOnLoad) => void;
/**
* OnConfigSuccess callback
*/
onConfigSuccess?: (callbackObj: CbObjOnConfigSuccess) => void;
/**
* OnFieldValid callback
*/
onFieldValid?: (callbackObj: CbObjOnFieldValid) => void;
/**
* OnAllValid callback
*/
onAllValid?: (callbackObj: CbObjOnAllValid) => void;
/**
* OnBrand callback
*/
onBrand?: (callbackObj: CbObjOnBrand) => void;
/**
* OnError callback
*/
onError?: (callbackObj: CbObjOnError) => void;
/**
* OnFocus callback
*/
onFocus?: (callbackObj: CbObjOnFocus) => void;
/**
* OnBinValue callback
*/
onBinValue?: (callbackObj: CbObjOnBinValue) => void;
/**
* OnAutoComplete callback
*/
onAutoComplete?: (callbackObj: CbObjOnAutoComplete) => void;
...
To start off with a little more strict typing, I have updated the type
field in CbObjOnConfigSuccess
with keyof PaymentMethods
.
src/components/internal/SecuredFields/lib/types.ts
import { PaymentMethods } from '../../../../types';
...
export interface CbObjOnConfigSuccess {
iframesConfigured: boolean;
type: keyof PaymentMethods;
}
...
Additional context Tested changed above successfully locally.
Hi @nklaasse,
Thanks for the pointing this out. Indeed we are missing the types for those events. We'll make a note to implement those in a future release.
These types were all added as part of the Card component (packages/lib/src/components/Card/types.ts
) in November 2020