Appearance
npm package
Use the package when your project has a bundler and you want typed imports.
sh
npm install @justonecx/sdkts
import { init } from "@justonecx/sdk";
void init({
publicKey: "pk_your_workspace_key",
apiUrl: "https://api.justonecx.qd.je",
});The package is not on npm yet
@justonecx/sdk is not published yet. Until it is, use the script tag. The API is identical, so you can switch later without changes to your calls.
Rules
- Call
init()once, in the browser only, after your app mounts. - Importing the package on the server is safe. Calling
init()on the server is not, because it useswindowanddocument. - Always pass
apiUrl. The default only works onlocalhost.
Options
See init and options.
Types
The package ships TypeScript types for ESM and CommonJS. No @types package is needed.
Next
Frameworks shows where to put init() in each framework.