Client
SazitoClient construction, lifecycle controls, and module access.
Factory
import { createSazitoClient } from '@sazito/client-sdk';
const client = createSazitoClient({
domain: 'mystore.sazito.com',
});createSazitoClient(config) input
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Required | Store domain without protocol. |
timeout | number | Optional | Global request timeout. |
retry | RetryConfig | Optional | Retry policy for 5xx responses. |
cache | Record<string, CacheConfig> | Optional | Module-level cache policy. |
customFetchApi | typeof fetch | Optional | Custom fetch implementation. |
debug | boolean | Optional | SDK debug logs. |
Lifecycle methods
Set Auth Token
Use: setAuthToken(token: string): void.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Required | Raw JWT token stored in browser storage. |
Get Auth Token
Use: getAuthToken(): string | null.
Returns currently stored token.
Clear Auth
Use: clearAuth(): void.
Removes persisted auth token.
Is Authenticated
Use: isAuthenticated(): boolean.
Returns true when token exists.
Clear Cache
Use: clearCache(): void.
Clears SDK cache.
Clear Credentials
Use: clearCredentials(): void.
Clears guest checkout credentials.
Clear All
Use: clearAll(): void.
Clears auth token, cache, and credentials.
Modules
Checkout and sales flow modules
| Module | Purpose |
|---|---|
cart | Start checkout for guest or authenticated users, add/update/remove line items, and persist cart credentials. |
invoices | Build checkout invoice from cart, attach shipping address/method, apply discount/credit, and prepare payment state. |
shipping | Create/update buyer address and read shipping method catalog used during checkout. |
payments | Fetch payment methods, create payment, handle redirect/upload/code steps (including card-to-card), and finalize checkout. |
orders | Read authenticated order history and order details after checkout. |
users | Authenticate users and merge guest checkout data into account context when needed. |
Catalog and storefront modules
| Module | Purpose |
|---|---|
products | Product listings, details, and product-centric discovery. |
categories | Category tree and category pages. |
search | Keyword/product search and discovery filtering support. |
menu | Store navigation/menu structures. |
entityRoutes | Resolve slugs/routes to entity metadata. |
images | Image retrieval helpers for media-heavy views. |
cms | CMS pages/blocks content for storefront pages. |
general | Store-wide metadata and shop configuration. |
Engagement and supporting modules
| Module | Purpose |
|---|---|
feedbacks | Product/shop feedback and review operations. |
wallet | Wallet balance and wallet transaction APIs (including checkout credit). |
visits | Visit analytics/reporting endpoints. |
booking | Booking-related retrieval for schedulable offerings. |
dynamicForms | Dynamic form schema and form-related checkout/product inputs. |
regions | Regions/cities lookup used by shipping and address forms. |
Direct module factory exports
You can import module factories directly from the package root when you do not need a full client instance.
import { products, categories, cart, invoices } from '@sazito/client-sdk';
const productsApi = products({ domain: 'mystore.sazito.com' });
const categoriesApi = categories({ domain: 'mystore.sazito.com' });
const cartApi = cart({ domain: 'mystore.sazito.com' });
const invoicesApi = invoices({ domain: 'mystore.sazito.com' });All available aliases:
products, categories, cart, orders, invoices, shipping,
payments, users, search, feedbacks, wallet, cms, images,
visits, booking, dynamicForms, regions, entityRoutes, menu, general.
Type Details
The following tables are generated from SDK TypeScript types and include nested object fields.
SazitoConfig
Source: src/core/config.ts
| Field | Type | Required |
|---|---|---|
domain | string | Required |
timeout | number | Optional |
retry | RetryConfig | Optional |
cache | { products?: CacheConfig; categories?: CacheConfig; cart?: CacheConfig; orders?: CacheConfig; search?: CacheConfig; cms?: CacheConfig; tags?: CacheConfig; entityRoutes?: CacheConfig; } | Optional |
cache.products | CacheConfig | Optional |
cache.categories | CacheConfig | Optional |
cache.cart | CacheConfig | Optional |
cache.orders | CacheConfig | Optional |
cache.search | CacheConfig | Optional |
cache.cms | CacheConfig | Optional |
cache.tags | CacheConfig | Optional |
cache.entityRoutes | CacheConfig | Optional |
customFetchApi | typeof fetch | Optional |
debug | boolean | Optional |
RetryConfig
Source: src/core/config.ts
| Field | Type | Required |
|---|---|---|
enabled | boolean | Required |
retries | number | Required |
retryDelay | number | Required |
CacheConfig
Source: src/core/config.ts
| Field | Type | Required |
|---|---|---|
enabled | boolean | Required |
ttl | number | Optional |