Skip to content

Commit 6a6afc6

Browse files
committed
fixing event listeners
1 parent 244c158 commit 6a6afc6

File tree

1 file changed

+40
-11
lines changed
  • launcher-csharp/WebForms/Views/CreateAndEmbedForm

1 file changed

+40
-11
lines changed

launcher-csharp/WebForms/Views/CreateAndEmbedForm/Embed.cshtml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async function loadWebform() {
2929
var instanceToken = '@ViewBag.InstanceToken'.replace(/+/g, "+");
3030
const { loadDocuSign } = window.DocuSign
3131
const docusign = await loadDocuSign('@ViewBag.IntegrationKey');
32-
32+
3333
const webFormOptions = {
3434
//Used with the runtime API workflow, for private webforms this is needed to render anything
3535
instanceToken: instanceToken,
@@ -46,21 +46,50 @@ async function loadWebform() {
4646
minHeight: "1500px",
4747
},
4848
//Controls the auto resize behavior of the iframe
49-
autoResizeHeight: true,
50-
//These values are passed to the iframe URL as query params
51-
tracking: {
52-
"tracking-field": "tracking-value",
53-
},
54-
//These values are passed to the iframe URL as hash params
55-
hidden: {
56-
"hidden-field": "hidden-value",
57-
},
49+
autoResizeHeight: true
5850
};
5951
6052
const webFormWidget = docusign.webforms({
6153
url: "@ViewBag.Url",
6254
options: webFormOptions,
63-
})
55+
});
56+
57+
//Basic milestones in this workflow
58+
webFormWidget.on('ready', (event) => {
59+
// event = { type: 'ready' };
60+
console.log('debug form loaded', event);
61+
});
62+
63+
webFormWidget.on('submitted', (event) => {
64+
// event = { type: 'submitted', envelopeId: 'abcd1234' };
65+
console.log('debug form submitted', event);
66+
});
67+
68+
webFormWidget.on('signingReady', (event) => {
69+
// event = { type: 'submitted', envelopeId: 'abcd1234' };
70+
console.log('debug form signingReady', event);
71+
});
72+
73+
webFormWidget.on('sessionEnd', (event) => {
74+
//There are 3 sessionEnd types sessionTimeout, remoteSigningInitiated, signingResult
75+
76+
// event = { type: 'sessionEnd', sessionEndType: 'sessionTimeout' };
77+
// event = {
78+
// type: 'sessionEnd',
79+
// sessionEndType: 'signingResult',
80+
// signingResultType: 'signing_complete',
81+
// returnUrl: 'bigcorp.com',
82+
// envelopeId: 'abcd1234',
83+
// };
84+
// event = { type: 'sessionEnd', sessionEndType: 'remoteSigningInitiated', envelopeId: 'abcd1234' };
85+
console.log('debug form signingResult', event);
86+
});
87+
88+
//Less commonly used events
89+
webFormWidget.on('userActivity', (event) => {
90+
// event = { type: 'userActivity', activityType: 'click' | 'keydown' };
91+
console.log('debug form userActivity', event);
92+
});
6493
6594
webFormWidget.mount("#docusign");
6695
}

0 commit comments

Comments
 (0)