@@ -19,12 +19,13 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
1919 // args.accountId
2020 // args.startingView -- 'recipient' or 'tagging'
2121
22+ //ds-snippet-start:eSign11Step2
2223 let dsApiClient = new docusign . ApiClient ( ) ;
2324 dsApiClient . setBasePath ( args . basePath ) ;
2425 dsApiClient . addDefaultHeader ( 'Authorization' , 'Bearer ' + args . accessToken ) ;
2526 let envelopesApi = new docusign . EnvelopesApi ( dsApiClient ) ;
2627
27- // Step 1 . Make the envelope with "created" (draft) status
28+ // Step 2 . Make the envelope with "created" (draft) status
2829 args . envelopeArgs . status = 'created' ; // We want a draft envelope
2930
3031 let envelope = makeEnvelope ( args . envelopeArgs ) ;
@@ -33,8 +34,10 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
3334 envelopeDefinition : envelope ,
3435 } ) ;
3536 let envelopeId = results . envelopeId ;
36-
37- // Step 2. create the sender view
37+ //ds-snippet-end:eSign11Step2
38+
39+ // Step 3. create the sender view
40+ //ds-snippet-start:eSign11Step3
3841 let viewRequest = makeSenderViewRequest ( args . envelopeArgs ) ;
3942 // Call the CreateSenderView API
4043 // Exceptions will be caught by the calling function
@@ -44,6 +47,7 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
4447
4548 // Switch to Recipient and Documents view if requested by the user
4649 let url = results . url ;
50+ //ds-snippet-end:eSign11Step3
4751 console . log ( `startingView: ${ args . startingView } ` ) ;
4852 if ( args . startingView === 'recipient' ) {
4953 url = url . replace ( 'send=1' , 'send=0' ) ;
@@ -52,6 +56,7 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
5256 return { envelopeId : envelopeId , redirectUrl : url } ;
5357} ;
5458
59+ //ds-snippet-start:eSign11Step3
5560function makeSenderViewRequest ( args ) {
5661 let viewRequest = new docusign . ReturnUrlRequest ( ) ;
5762 // Data for this method
@@ -62,7 +67,9 @@ function makeSenderViewRequest(args) {
6267 viewRequest . returnUrl = args . dsReturnUrl ;
6368 return viewRequest ;
6469}
65-
70+ //ds-snippet-end:eSign11Step3
71+
72+ //ds-snippet-start:eSign11Step2
6673function makeEnvelope ( args ) {
6774 // Data for this method
6875 // args.signerEmail
@@ -219,5 +226,6 @@ function document1(args) {
219226 </html>
220227 ` ;
221228}
222-
229+ //ds-snippet-end:eSign11Step2
230+
223231module . exports = { sendEnvelopeUsingEmbeddedSending } ;
0 commit comments