- 
                Notifications
    You must be signed in to change notification settings 
- Fork 852
Add documentation for new custom flow APIs #2680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Draft
      
      
            dstaley
  wants to merge
  18
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
ds.feat/custom-flow-apis
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Draft
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | The latest updates on your projects. Learn more about Vercel for GitHub. 
 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
🔎 Previews:
What does this solve?
This PR adds documentation for our new custom flows APIs, which are available in JavaScript-based SDKs built on top of React. These APIs will become the default APIs in the next major version of
@clerk/react.What changed?
One of the challenges of documenting these new APIs is that they've diverged from the APIs previously used for other SDKs, primarily our iOS and Android SDKs. This poses a unique challenge because the concept of what must be done to accomplish a sign-in or sign-up is now dependent upon the SDK used, whereas the current documentation depends on all SDKs using the same foundational ideas. For example, the new APIs no longer have the concept of "preparing", which the current docs reference. To alleviate this, the new guides utilize the
<If>conditional component to selectively render different language and code examples based on the selected SDK, which allows us to directly reference the new API methods when the currently selected SDK is one that utilizes the new APIs.This, however, causes another issue, which is what content should be shown when the current selected SDK doesn't have any examples for custom flows? As is, selecting a SDK such as Express would result in neither of the
<If>statements being true, which would prevent any content from showing. To prevent showing blank content, the new guides utilize thesdkfront matter attribute to only show the guides in the sidebar when a relevant SDK is selected.Also, since the previous APIs are still available for backwards compatibility, the original docs have been copied to the
/legacyfolder to allow customers to still access the guides for reference.Note
As of writing, the legacy guides do not utilize the
sdkfront matter attribute, but they probably should, otherwise the sidebar will look like this:The new custom flow APIs are built upon the
SignInFutureandSignUpFutureclasses. Since we're not planning a major release ofclerk-js, these classes are being made available to access the new APIs. The documentation for these new classes have been added alongside the existingSignInandSignUpAPI documentation, and serves as the canonical reference documentation for thesignInandsignUpexports of the newuseSignInanduseSignUphooks.Note
I'm working on getting the
<Typedoc>component to work well with the newSignInFutureandSignUpFuturetypes for the autogenerated documentation foruseSignInanduseSignUp. If I'm unable to get it to work, I'll link out to theSignInFutureandSignUpFuturedocumentation.Checklist