← All packages

@lacspace/sdk

v2.1.1Core3 @lacspace deps

High-level TypeScript SDK for Lacspace — api, auth, analytics and e-commerce in one client.

npm i @lacspace/sdk

Usage

sdk.ts
import { LacspaceSDK } from "@lacspace/sdk";

const lac = new LacspaceSDK({ baseURL: "https://api.lacspace.com/api" });

// 1 · Authenticate — the token is stored and reused everywhere
const { user } = await lac.auth.login({ email: "you@shop.com", password: "••••••••" });

// 2 · E-commerce helpers
const products = await lac.ecommerce.getProducts();
await lac.ecommerce.addToCart({ productId: products[0]!.id, quantity: 1 });
const { orderId } = await lac.ecommerce.checkout("cart_123");

// 3 · Track what happened
await lac.analytics.track("checkout_completed", { orderId });

Exports 12

LacspaceAnalyticsLacspaceApiLacspaceApiErrorLacspaceAuthLacspaceSDKcreateAnalyticscreateApicreateAuthcreateClientisApiErrorlocalStorageTokenStoragememoryTokenStorage

Keywords

lacspacesdkecommerceauthanalyticstypescript

More in Core