Skip to content

Commit 48b448a

Browse files
committed
2 parents b7ac303 + 90e8274 commit 48b448a

File tree

5 files changed

+53
-34
lines changed

5 files changed

+53
-34
lines changed

lib/eSignature/controllers/eg011EmbeddedSending.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,20 @@ eg011EmbeddedSending.createController = async (req, res) => {
4242
// Step 2. Call the worker method
4343
const { body } = req;
4444
// Additional data validation might also be appropriate
45-
const startingView = validator.escape(body.startingView);
4645
const envelopeArgs = {
4746
signerEmail: validator.escape(body.signerEmail),
4847
signerName: validator.escape(body.signerName),
4948
ccEmail: validator.escape(body.ccEmail),
5049
ccName: validator.escape(body.ccName),
5150
dsReturnUrl: dsReturnUrl,
51+
startingView: validator.escape(body.startingView),
5252
doc2File: path.resolve(demoDocsPath, doc2File),
5353
doc3File: path.resolve(demoDocsPath, doc3File)
5454
};
5555
const args = {
5656
accessToken: req.user.accessToken,
5757
basePath: req.session.basePath,
5858
accountId: req.session.accountId,
59-
startingView: startingView,
6059
envelopeArgs: envelopeArgs
6160
};
6261
let results = null;

lib/eSignature/examples/embeddedSending.js

+45-25
Original file line numberDiff line numberDiff line change
@@ -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,42 +34,21 @@ 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
4441
results = await envelopesApi.createSenderView(args.accountId, envelopeId, {
45-
returnUrlRequest: viewRequest,
42+
envelopeViewRequest: viewRequest,
4643
});
4744

4845
// Switch to Recipient and Documents view if requested by the user
4946
let url = results.url;
50-
//ds-snippet-end:eSign11Step3
51-
console.log(`startingView: ${args.startingView}`);
52-
if (args.startingView === 'recipient') {
53-
url = url.replace('send=1', 'send=0');
54-
}
47+
console.log(`startingView: ${args.envelopeArgs.startingView}`);
5548

5649
return { envelopeId: envelopeId, redirectUrl: url };
5750
};
5851

59-
//ds-snippet-start:eSign11Step3
60-
function makeSenderViewRequest(args) {
61-
let viewRequest = new docusign.ReturnUrlRequest();
62-
// Data for this method
63-
// args.dsReturnUrl
64-
65-
// Set the url where you want the recipient to go once they are done signing
66-
// should typically be a callback route somewhere in your app.
67-
viewRequest.returnUrl = args.dsReturnUrl;
68-
return viewRequest;
69-
}
70-
//ds-snippet-end:eSign11Step3
71-
72-
//ds-snippet-start:eSign11Step2
7352
function makeEnvelope(args) {
7453
// Data for this method
7554
// args.signerEmail
@@ -186,6 +165,48 @@ function makeEnvelope(args) {
186165

187166
return env;
188167
}
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
189210

190211
/**
191212
* Creates document 1
@@ -226,6 +247,5 @@ function document1(args) {
226247
</html>
227248
`;
228249
}
229-
//ds-snippet-end:eSign11Step2
230250

231251
module.exports = { sendEnvelopeUsingEmbeddedSending };

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"csurf": "^1.11.0",
3636
"docusign-admin": "^2.3.0",
3737
"docusign-click": "^2.2.0",
38-
"docusign-esign": "^6.6.0-rc2",
38+
"docusign-esign": "^7.0.0-rc1",
3939
"docusign-maestro": "1.0.0-rc3",
4040
"docusign-monitor": "^2.1.0",
4141
"docusign-rooms": "^2.0.0",

views/pages/examples/eg011EmbeddedSending.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<div class="form-group">
1111
<label for="startingView"><%= example.Forms[0].Inputs[0].InputName %></label>
1212
<select id="startingView" name="startingView" class="form-control">
13-
<option value="tagging" selected>Tagging view</option>
14-
<option value="recipient">Recipient &amp; Documents view</option>
13+
<option value="Tagger" selected>Tagging view</option>
14+
<option value="Prepare">Prepare view</option>
1515
</select>
1616
</div>
1717
<div class="form-group">

0 commit comments

Comments
 (0)