@@ -15,7 +15,11 @@ export const TrusteeContext = createContext<TrusteeContextProps>({
1515 send : ( _ , __ ) => ( { } ) ,
1616 onCorrect : ( ) => { } ,
1717 onRemove : ( ) => new Promise ( ( res ) => res ( ) ) ,
18- addressAPI : { get : ( ) => new Promise ( ( res ) => res ( ) ) } ,
18+ addressAPI : {
19+ get : ( endpoint ) => Promise . resolve ( endpoint ) ,
20+ extract : 'results' ,
21+ limit : 50 ,
22+ } ,
1923} ) ;
2024
2125type RenderProps = ( _ : TrusteeContextProps ) => ReactElement ;
@@ -42,6 +46,15 @@ export interface TrusteeInput {
4246 [ key : string ] : any ;
4347}
4448
49+ export type AddressAPIType = {
50+ /** API instance with auth to get a list of addresses */
51+ get : ( endpoint : string ) => Promise < any > ;
52+ /** interface return path to the results array */
53+ extract : string ;
54+ /** limit of items to display per search */
55+ limit : number ;
56+ } ;
57+
4558export interface TrusteeContextProps {
4659 complete ?: boolean ;
4760 testId ?: string ;
@@ -50,7 +63,7 @@ export interface TrusteeContextProps {
5063 onRemove : ( ...args : any [ ] ) => Promise < any > ;
5164 onCorrect : ( ...args : any [ ] ) => void ;
5265 send : ( event : any , payload ?: EventData ) => Partial < State < TC , any , any , any > > ;
53- addressAPI : any ;
66+ addressAPI : AddressAPIType ;
5467 current : Partial < State < TC , any , any , any > > ;
5568}
5669
@@ -62,7 +75,8 @@ export interface TrusteeCardProps {
6275 onDetailsSave : ( values : any , trustee : TrusteeProps ) => Promise < any > ;
6376 onContactSave : ( values : any , trustee : TrusteeProps ) => Promise < any > ;
6477 onAddressSave : ( values : any , trustee : TrusteeProps ) => Promise < any > ;
65- addressAPI : any ;
78+ addressAPI : AddressAPIType ;
79+ /** depending on your network lib, provide a path to the addressAPI results array */
6680 testId ?: string ;
6781 children ?: RenderProps | ReactElement ;
6882 cfg ?: SpaceProps ;
0 commit comments