@fleck.chat/partner-sdk
v0.1.1-alpha.1
Published
Browser SDK to embed a whitelabeled Fleck iframe and authenticate users via postMessage.
Maintainers
Readme
Fleck Partner SDK
This browser SDK lets partner frontends embed a whitelabeled Fleck iframe and authenticate users via postMessage.
Install (Consumers)
Add the SDK package to your app:
npm install @fleck.chat/partner-sdk[!NOTE] TypeScript types are included.
Install (Contributors)
Install dependencies locally:
npm installBuild
Compiles fleck_sdk.cljs and bundles it into a single browser-ready file at dist/fleck_sdk.mjs.
npm run buildTest
Runs browser-based tests in Chromium (via Web Test Runner + Playwright).
npm run test:install # run once to download browsers
npm run testPublish
npm publish --access publicSDK Interface
fleckSdk.init(options) returns a Promise that resolves to an SDK instance:
fleck.auth({ jwt }): Sends the partner-signed JWT to the iframe.fleck.iframe: The<iframe>element created by the SDK.fleck.origin: The computed origin fromsrc(e.g.,https://fleck.partner.gltd/app→https://fleck.partner.gltd).
Usage
<div id="fleck-container"></div>
<script type="module" src="./dist/fleck_sdk.mjs"></script>
<script type="module">
const options = {
container: document.getElementById('fleck-container'),
src: 'https://fleck.partner.gltd'
};
const fleck = await fleckSdk.init(options);
fleck.auth({ jwt: window.FLECK_JWT });
</script>License
MIT. See LICENSE.
