@areskit/standalone
v0.1.0-alpha.6
Published
A standalone build of the Ares SDK for seamless integration into web applications.
Downloads
13
Readme
Ares Standalone SDK
A standalone build of the Ares SDK for seamless integration into web applications. This package bundles all required dependencies and exposes a simple API for rendering the Ares KYC workflow.
Prerequisites
Before launching the KYC workflow, your backend must generate a temporary user token by calling the Ares API. This token authenticates the user throughout the workflow.
Step 1: Obtain a Client Access Token
Authenticate with the API using your client credentials. For detailed instructions, see the Authentication Guide.
curl -sS -f -X POST "${CRM_URL}/oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=client_credentials&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}"Step 2: Generate a User Token
Use the access_token from Step 1 to generate a temporary token for the user. The USER_ID is a unique identifier for the user in your system (e.g., a database primary key or UUID).
curl -sS -f -X GET "${API_URL}/api/digital-onboarding/token?userId=${USER_ID}" \
-H "Authorization: Bearer ${access_token}" \
-H "x-domain-id: ${X_DOMAIN_ID}" \
-H "Origin: ${ORIGIN}"The returned access_token is the temporary user token. Pass it to the credentialProvider function when initializing the SDK.
Installation & Integration
With a Bundler
Install the package using your preferred package manager:
npm install @areskit/standalone
# or
pnpm add @areskit/standalone
# or
yarn add @areskit/standalone
# or
bun add @areskit/standaloneThen import and initialize the SDK:
import { createAreskit } from '@areskit/standalone';
import '@areskit/standalone/styles.css';
const areskit = createAreskit({
crmUrl: `${CRM_URL}`,
apiUrl: `${API_URL}`,
domainId: DOMAIN_ID,
credentialProvider: async () => 'access_token',
});
const root = document.getElementById('root');
areskit.render(root);Without a Bundler
Include the SDK directly via CDN:
<link
rel="stylesheet"
href="https://unpkg.com/@areskit/standalone/dist/umd/styles.css"
/>
<script src="https://unpkg.com/@areskit/standalone/dist/umd/areskit.js"></script>Then initialize from the global Areskit object:
const areskit = window.Areskit.create({
crmUrl: `${CRM_URL}`,
apiUrl: `${API_URL}`,
domainId: DOMAIN_ID,
credentialProvider: async () => 'access_token',
});
const root = document.getElementById('root');
areskit.render(root);