@@ -110,9 +110,6 @@ type IsConnectedAsDelegateParams = WithDelegatedAccess;
110110// Connect as delegate
111111type ConnectParams = WithEmail & WithDelegatedAccess & WithOldDotFlag & WithCredentials & WithSession & WithActivePolicyID ;
112112
113- // Clear pending action for role update
114- type ClearDelegateRolePendingActionParams = WithEmail & WithDelegatedAccess ;
115-
116113/**
117114 * Connects the user as a delegate to another account.
118115 * Returns a Promise that resolves to true on success, false on failure, or undefined if not applicable.
@@ -332,10 +329,6 @@ function clearDelegatorErrors({delegatedAccess}: ClearDelegatorErrorsParams) {
332329 Onyx . merge ( ONYXKEYS . ACCOUNT , { delegatedAccess : { delegators : delegatedAccess . delegators . map ( ( delegator ) => ( { ...delegator , errorFields : undefined } ) ) } } ) ;
333330}
334331
335- function requestValidationCode ( ) {
336- API . write ( WRITE_COMMANDS . RESEND_VALIDATE_CODE , null ) ;
337- }
338-
339332function addDelegate ( { email, role, validateCode, delegatedAccess} : AddDelegateParams ) {
340333 if ( ! delegatedAccess ?. delegates ) {
341334 return ;
@@ -669,34 +662,6 @@ function updateDelegateRole({email, role, validateCode, delegatedAccess}: Update
669662 API . write ( WRITE_COMMANDS . UPDATE_DELEGATE_ROLE , parameters , { optimisticData, successData, failureData} ) ;
670663}
671664
672- function clearDelegateRolePendingAction ( { email, delegatedAccess} : ClearDelegateRolePendingActionParams ) {
673- if ( ! delegatedAccess ?. delegates ) {
674- return ;
675- }
676-
677- const optimisticData : Array < OnyxUpdate < typeof ONYXKEYS . ACCOUNT > > = [
678- {
679- onyxMethod : Onyx . METHOD . MERGE ,
680- key : ONYXKEYS . ACCOUNT ,
681- value : {
682- delegatedAccess : {
683- delegates : delegatedAccess . delegates . map ( ( delegate ) =>
684- delegate . email === email
685- ? {
686- ...delegate ,
687- pendingAction : null ,
688- pendingFields : undefined ,
689- }
690- : delegate ,
691- ) ,
692- } ,
693- } ,
694- } ,
695- ] ;
696-
697- Onyx . update ( optimisticData ) ;
698- }
699-
700665function restoreDelegateSession < TKey extends OnyxKey > ( authenticateResponse : Response < TKey > ) {
701666 Onyx . clear ( KEYS_TO_PRESERVE_DELEGATE_ACCESS ) . then ( ( ) => {
702667 updateSessionAuthTokens ( authenticateResponse ?. authToken , authenticateResponse ?. encryptedAuthToken ) ;
@@ -719,11 +684,9 @@ export {
719684 disconnect ,
720685 clearDelegatorErrors ,
721686 addDelegate ,
722- requestValidationCode ,
723687 clearDelegateErrorsByField ,
724688 restoreDelegateSession ,
725689 isConnectedAsDelegate ,
726- clearDelegateRolePendingAction ,
727690 updateDelegateRole ,
728691 removeDelegate ,
729692 openSecuritySettingsPage ,
0 commit comments