To build this project, you need node and npm
npm install
Run tests
npm run unit-tests
The SDK can also be used client side.
To Compile the client-side SDK, go to the root folder of the SDK and compile the SDK
node ./compile.js
It generates a file named dist/bundle.js
ACC client-side SDK compiler version 0.1.0 Bundling ../package.json Bundling ./web/jsdom.js Bundling ./web/crypto.js Bundling ./web/request.js Bundling ./xtkCaster.js Bundling ./domUtil.js Bundling ./xtkEntityCache.js Bundling ./methodCache.js Bundling ./optionCache.js Bundling ./soap.js Bundling ./crypto.js Bundling ./client.js Bundling ./index.js Client-side SDK generated in ./dist/bundle.js
Using the client side SDK cannot be done directly because the Campaign server has CORS configured to reject HTTP requests from resources not served by Campaign. Therefore a server-side proxy is need to relay the calls to Campaign, or you need to serve the SDK and corresponding web pages from Campaign itself
Once compiled, copy it to the Campaign server (here on a dev environment).
cd /c/cygwin64/home/neolane/ac cp "Z:\amorin On My Mac\Documents\dev\git\ac7\acc-js-sdk\dist/bundle.js" nl/web/accSDK.js
This makes them available on the following endpoint
/nl/accSDK.js
<script src="accSDK.js"></script>Use the SDK. Note that the SDK variable is now called `document.accSDK` to avoid potential name collision with the common name "sdk".
<script> (async () => { const sdk = document.accSDK; const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword( "http://ffdamid:8080", "admin", "admin"); const client = await sdk.init(connectionParameters); console.log(sdk.getSDKVersion()); await client.logon(); var databaseId = await client.getOption("XtkDatabaseId"); console.log(databaseId); document.getElementById("hello").textContent = databaseId; await client.logoff(); })(); </script>