Adobe changed their GitHub from the last time we imported their latest code for the JS SDK. It used to have pre-generated Browser specific JS files that you copy paste into the code, now it uses Swagger auto generation into Node.Js files and wants the users to browserify it to use it in browser js.
TL:DR I don't know how to convert the node.js files into browser files
I have tried following all of the instructions that they have in their readme, but nothing seems to work. The only thing I haven't tried (which could be the key) is to write my code in a JS file with the node.js "require()" to import the js files, then browserify my code. If that's what I have to do then I unfortunately will not be able to upgrade.
Right now the code that I use to access the api is this
<!-- supplied by Adobe before -->
<script type="text/javascript" src="~/scripts/sha1-min.js"></script>
<script type="text/javascript" src="~/scripts/adobe-sign-sdk.js"></script>
<script type="text/javascript" src="~/scripts/superagent.min.js"></script>
<script type="text/javascript" src="~/scripts/validator.min.js"><</script>
async function GenerateAuthForm() {
var context = new AdobeSignSdk.Context();
//Initialize the Widget API
var agreementApi = new AdobeSignSdk.AgreementsApi(context);
//Get the Widget model
var widgetsModel = AdobeSignSdk.AgreementsModel;
var agreementsModel = AdobeSignSdk.AgreementsModel;
//Populate the access token
/**/
var agreementCreationInfo = new agreementsModel.DocumentCreationInfo();
//does more work below
and that is super easy to call and use.
I want to be able to do that same process, but with the updated version, so I can use Workflows rather than agreements.
EDIT: I have tried to browserify the index.js located at /AdobeSignNodeJsSdk/src and it did combine all of the files, but I had no way to call it, or I didn't understand how to call it. I tried to call it as below
<script src="~/Scripts/bundle.js"></script>
<script>
var context = new SwaggerJsClient.ApiClient(); //this was undefined
var api = new context.WorkflowsApi()
//do stuff with the api or model
Furthermore in the file that was put through browserify, it references root.SwaggerJsClient.apiormethod, so I assumed that there is some way to call this, and I just don't know what it is.
I am closing this question as I figured out how to import the code properly using browserify like this
browserify -r ./index.js:AdobeSignSdk > bundle.js
then referencing it like
var adobeSignSdk = require('AdobeSignSdk');
var context = new adobeSignSdk.ApiClient();
And I would like to report that the "Latest version" after going through the code and determining how to use it, has significantly LESS functionality than the previous version. You cannot create a Workflow through 2.0, you can only get the existing ones, and their statuses. The previous release, 1.1.0 still doesn't work correctly when you try to create a workflow as they didn't include
customWorkflowAgreementCreationRequest.getDocumentCreationInfo()
so when you try to create one it fails with an error.
TypeError: customWorkflowAgreementCreationRequest.getDocumentCreationInfo is not a function
This is unfortunate as that is the feature I needed, and I will likely now have to switch my application from JS to the C# REST Api, something that needed to happen anyways, just waiting for when it wasn't so urgent.