@arc-publishing/sdk-identity
Version:
JS Identity SDK for working with Identity API
49 lines (31 loc) • 2.2 kB
Markdown
# sdk-identity
## Quick start
- `npm i`
Then, to run unit tests:
- `npm test`
To run development page locally
- `npm run start:dev` then go to http://localhost:8080/sdk-identity/
To run things behind a localhost trident you will need to follow these directions: https://github.com/WPMedia/arc-subs-ui/wiki/Admin---Trident#localhost-trident and run:
- `npm start` then go to http://localhost.arcpublishing.com/sdk-identity/
That's it!
## Docs
API Docs https://redirector.arcpublishing.com/alc/docs/api/arc-sdks/index.html
## Commands
- `npm start` - starts a server at http://localhost.arcpublishing.com/ using the umd bundle. The SDK will be located in `window.Identity`.
- `npm run start:dev` - starts a server at http://localhost:8080/ using the umd bundle. The SDK will be located in `window.Identity`.
- `npm run trident:rebuild` - rebuilds docker images (alias for `docker-compose up --force-recreate --build`).
- `npm run trident:down` - runs `docker-compose down`.
- `npm run build` - build, esm, commonjs, and umd versions of the library.
- `npm test` - run jest tests.
- `npm run test:ci` - run jest tests and save report artifact (ci-mode).
- `npm run test:watch` - run `jest --watch`.
- `npm run test:coverage` - show coverage report after running tests.
## Caveats
- This SDK is meant to run in the browser as it depends on `localStorage` and `fetch`.
- This SDK depends on the environment having a `Promise` implementation.
- This SDK also depends on the the environment having a `fetch` implementation.
### Polyfills
Due to this being a library used in many different websites, the polyfills need to be loaded by the user of the library. It should only be necessary to load the `fetch` and `Promise` polyfills for older browsers like IE11 (see: https://caniuse.com/#search=fetch and https://caniuse.com/#feat=promises). If you are using the sdk-loader, this will be polyfilled if necessary, so you don't need to do anything; however, if you want to load the polyfills yourself you can simply add this tag to your HTML:
```html
<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?flags=gated&features=default%2CPromise%2Cfetch"></script>
```