@@ -25,7 +25,7 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
2525 dsApiClient . addDefaultHeader ( 'Authorization' , 'Bearer ' + args . accessToken ) ;
2626 let envelopesApi = new docusign . EnvelopesApi ( dsApiClient ) ;
2727
28- // Step 2. Make the envelope with "created" (draft) status
28+ // Make the envelope with "created" (draft) status
2929 args . envelopeArgs . status = 'created' ; // We want a draft envelope
3030
3131 let envelope = makeEnvelope ( args . envelopeArgs ) ;
@@ -34,10 +34,7 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
3434 envelopeDefinition : envelope ,
3535 } ) ;
3636 let envelopeId = results . envelopeId ;
37- //ds-snippet-end:eSign11Step2
3837
39- // Step 3. create the sender view
40- //ds-snippet-start:eSign11Step3
4138 let viewRequest = makeSenderViewRequest ( args . envelopeArgs ) ;
4239 // Call the CreateSenderView API
4340 // Exceptions will be caught by the calling function
@@ -47,54 +44,11 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
4744
4845 // Switch to Recipient and Documents view if requested by the user
4946 let url = results . url ;
50- //ds-snippet-end:eSign11Step3
5147 console . log ( `startingView: ${ args . envelopeArgs . startingView } ` ) ;
5248
5349 return { envelopeId : envelopeId , redirectUrl : url } ;
5450} ;
5551
56- //ds-snippet-start:eSign11Step3
57- function makeSenderViewRequest ( args ) {
58- // Data for this method
59- // args.dsReturnUrl
60-
61- // Set the url where you want the recipient to go once they are done signing
62- // should typically be a callback route somewhere in your app.
63- let viewRequest = docusign . EnvelopeViewRequest . constructFromObject ( {
64- returnUrl : args . dsReturnUrl ,
65- viewAccess : 'envelope' ,
66- settings : docusign . EnvelopeViewSettings . constructFromObject ( {
67- startingScreen : args . startingView ,
68- sendButtonAction : 'send' ,
69- showBackButton : 'false' ,
70- backButtonAction : 'previousPage' ,
71- showHeaderActions : 'false' ,
72- showDiscardAction : 'false' ,
73- lockToken : '' ,
74- recipientSettings : docusign . EnvelopeViewRecipientSettings . constructFromObject ( {
75- showEditRecipients : 'false' ,
76- showContactsList : 'false'
77- } ) ,
78- documentSettings : docusign . EnvelopeViewDocumentSettings . constructFromObject ( {
79- showEditDocuments : 'false' ,
80- showEditDocumentVisibility : 'false' ,
81- showEditPages : 'false'
82- } ) ,
83- taggerSettings : docusign . EnvelopeViewTaggerSettings . constructFromObject ( {
84- paletteSections : 'default' ,
85- paletteDefault : 'custom'
86- } ) ,
87- templateSettings : docusign . EnvelopeViewTemplateSettings . constructFromObject ( {
88- showMatchingTemplatesPrompt : 'true'
89- } )
90- } )
91- } ) ;
92-
93- return viewRequest ;
94- }
95- //ds-snippet-end:eSign11Step3
96-
97- //ds-snippet-start:eSign11Step2
9852function makeEnvelope ( args ) {
9953 // Data for this method
10054 // args.signerEmail
@@ -211,6 +165,48 @@ function makeEnvelope(args) {
211165
212166 return env ;
213167}
168+ //ds-snippet-end:eSign11Step2
169+
170+ //ds-snippet-start:eSign11Step3
171+ function makeSenderViewRequest ( args ) {
172+ // Data for this method
173+ // args.dsReturnUrl
174+
175+ // Set the url where you want the recipient to go once they are done signing
176+ // should typically be a callback route somewhere in your app.
177+ let viewRequest = docusign . EnvelopeViewRequest . constructFromObject ( {
178+ returnUrl : args . dsReturnUrl ,
179+ viewAccess : 'envelope' ,
180+ settings : docusign . EnvelopeViewSettings . constructFromObject ( {
181+ startingScreen : args . startingView ,
182+ sendButtonAction : 'send' ,
183+ showBackButton : 'false' ,
184+ backButtonAction : 'previousPage' ,
185+ showHeaderActions : 'false' ,
186+ showDiscardAction : 'false' ,
187+ lockToken : '' ,
188+ recipientSettings : docusign . EnvelopeViewRecipientSettings . constructFromObject ( {
189+ showEditRecipients : 'false' ,
190+ showContactsList : 'false'
191+ } ) ,
192+ documentSettings : docusign . EnvelopeViewDocumentSettings . constructFromObject ( {
193+ showEditDocuments : 'false' ,
194+ showEditDocumentVisibility : 'false' ,
195+ showEditPages : 'false'
196+ } ) ,
197+ taggerSettings : docusign . EnvelopeViewTaggerSettings . constructFromObject ( {
198+ paletteSections : 'default' ,
199+ paletteDefault : 'custom'
200+ } ) ,
201+ templateSettings : docusign . EnvelopeViewTemplateSettings . constructFromObject ( {
202+ showMatchingTemplatesPrompt : 'true'
203+ } )
204+ } )
205+ } ) ;
206+
207+ return viewRequest ;
208+ }
209+ //ds-snippet-end:eSign11Step3
214210
215211/**
216212 * Creates document 1
@@ -251,6 +247,5 @@ function document1(args) {
251247 </html>
252248 ` ;
253249}
254- //ds-snippet-end:eSign11Step2
255250
256251module . exports = { sendEnvelopeUsingEmbeddedSending } ;
0 commit comments