Created
          November 25, 2019 23:34 
        
      - 
      
- 
        Save seanaguinaga/df8d97fabc52ca0f458363126390d031 to your computer and use it in GitHub Desktop. 
    Generated by XState Viz: https://xstate.js.org/viz
  
        
  
    
      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
    
  
  
    
  | const StandardConsentFormState = Machine( | |
| { | |
| id: "standardConsentMachine", | |
| initial: "unviewed", | |
| // context: { | |
| // viewed: false, | |
| // signed: false, | |
| // signature: null, | |
| // renderedPDF: null, | |
| // sent: false, | |
| // delivered: false, | |
| // error: null | |
| // }, | |
| //@ts-ignore | |
| states: { | |
| unviewed: { | |
| on: { | |
| FORMVIEWED: { | |
| target: "viewed", | |
| actions: "focusSignatureInput" | |
| } | |
| } | |
| }, | |
| viewed: { | |
| on: { | |
| FIELDFILLED: { | |
| target: "signed", | |
| actions: "enableSignButton" | |
| } | |
| } | |
| }, | |
| signed: { | |
| on: { | |
| FORMSIGNED: { | |
| target: "rendering" | |
| } | |
| } | |
| }, | |
| rendering: { | |
| onEntry: "renderConsentFormWithSignature", | |
| on: { | |
| FORMRENDERED: { | |
| target: "rendersuccess" | |
| }, | |
| FORMRENDERFAILED: { | |
| target: "renderfailure" | |
| } | |
| } | |
| }, | |
| rendersuccess: { | |
| onEntry: "sendPDFToTrueVault", | |
| on: { | |
| FORMSENT: { | |
| target: "sending" | |
| } | |
| } | |
| }, | |
| renderfailure: { | |
| on: { | |
| RETRYRENDER: { | |
| target: "rendering" | |
| } | |
| } | |
| }, | |
| sending: { | |
| on: { | |
| FORMNOTDELIVERED: { | |
| actions: "deliveryError", | |
| target: "sendfailure" | |
| }, | |
| FORMDELIVERED: { | |
| target: "sendsuccess" | |
| } | |
| } | |
| }, | |
| sendfailure: { | |
| on: { | |
| RETRYSEND: { | |
| target: "sending" | |
| } | |
| } | |
| }, | |
| sendsuccess: { | |
| onEntry: "markCompleted" | |
| } | |
| } | |
| }, | |
| { | |
| actions: {} | |
| } | |
| ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment