@cabide/vto-sdk
v1.0.1
Published
Virtual Try-On (VTO) SDK for integrating Cabide's virtual try-on experience into web applications.
Readme
@cabide/vto-sdk
Virtual Try-On (VTO) SDK for integrating Cabide's virtual try-on experience into web applications.
Installation
npm install @cabide/vto-sdkyarn add @cabide/vto-sdkpnpm add @cabide/vto-sdkUsage
Initialize the SDK
Before opening the try-on experience, initialize the SDK with your base URL:
import { init } from '@cabide/vto-sdk';
init({
baseUrl: 'https://your-vto-server.com'
});Open the Virtual Try-On
Launch the try-on modal for a specific store and garment:
import { openTryOn } from '@cabide/vto-sdk';
openTryOn(storeId, garmentId);Check Available Credits
Check if the user has available credits for try-ons:
import { hasAvailableCredits } from '@cabide/vto-sdk';
const hasCredits = await hasAvailableCredits(storeId);
if (hasCredits) {
// Allow try-on
}API Reference
| Function | Parameters | Returns | Description |
| --- | --- | --- | --- |
| init({ baseUrl }) | baseUrl (string) | void | Initialize the SDK with the base URL of your VTO server. Must be called before openTryOn(). |
| openTryOn(storeId, garmentId) | storeId (string), garmentId (string) | void | Opens the virtual try-on modal for the specified store and garment. |
| hasAvailableCredits(storeId) | storeId (string) | Promise<boolean> | Checks if the store has available credits for virtual try-on sessions. |
License
MIT
