The javascript SDK provides client-side functionalities for adding embedded app to the prosperworks web client.
Embedded app is an iframe embedded in the prosperworks web page. The display location of the iframe is configured in the embedded app setting page.
yarn add pw-app-sdk
# or
npm install pw-app-sdk --save
Then you could just do
import PWSDK from 'pw-app-sdk';
const sdk = PWSDK.init();
sdk.getContext()
.then(({ context }) => {
// do something with the context
});
pw-app-sdk
is served with https://www.jsdelivr.com/package/npm/pw-app-sdk
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/pw-app-sdk@latest/dist/pwsdk.min.js"></script>
<script type="text/javascript">
var sdk = window.PWSDK.init();
sdk.getContext()
.then(function (data) {
var type = data.type; // person,lead,...
var context = data.context;
// do something with the context
});
</script>
https://prosperworks.github.io/pw-app-sdk
Before development, make sure you installed all packages. We are using yarn for this project.
yarn
## watch changes
yarn dev:es
# or
yarn dev:commonjs
## build
yarn build
## test
yarn test
# or watch changes
yarn test:dev
## lint
yarn lint
You could do yarn link
in this repo, and go to your other repo and do
yarn link pw-app-sdk
.
Alternatively, you could also do npm link path/to/pw-app/sdk
in your repo.