Skip to content

Commit dcb86af

Browse files
committed
Embedded sending update
1 parent fd3aca3 commit dcb86af

File tree

5 files changed

+40
-16
lines changed

5 files changed

+40
-16
lines changed

lib/eSignature/controllers/eg011EmbeddedSending.js

Lines changed: 1 addition & 2 deletions
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

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,54 @@ const sendEnvelopeUsingEmbeddedSending = async (args) => {
4242
// Call the CreateSenderView API
4343
// Exceptions will be caught by the calling function
4444
results = await envelopesApi.createSenderView(args.accountId, envelopeId, {
45-
returnUrlRequest: viewRequest,
45+
envelopeViewRequest: viewRequest,
4646
});
4747

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

5653
return { envelopeId: envelopeId, redirectUrl: url };
5754
};
5855

5956
//ds-snippet-start:eSign11Step3
6057
function makeSenderViewRequest(args) {
61-
let viewRequest = new docusign.ReturnUrlRequest();
6258
// Data for this method
6359
// args.dsReturnUrl
6460

6561
// Set the url where you want the recipient to go once they are done signing
6662
// should typically be a callback route somewhere in your app.
67-
viewRequest.returnUrl = args.dsReturnUrl;
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+
6893
return viewRequest;
6994
}
7095
//ds-snippet-end:eSign11Step3

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)