API Reference
Menu
Fetch and normalize storefront navigation trees.
Method
Get Header Menu
Use: menu.getHeaderMenu(identifier?, options?).
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | string | Optional | Menu identifier. Defaults to headermenu. |
options | RequestOptions | Optional | Per-request controls. |
Returns: SazitoResponse<MenuItem[]>.
MenuItem fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Required | Display label. |
url | string | Required | Navigation URL. |
children | MenuItem[] | Required | Child navigation items. |
Notes
- Disabled entities are filtered out.
- Nested nodes are recursively converted.
- SDK normalizes multiple backend node types into one
MenuItemshape.
Examples
// app/lib/sazito-client.ts
import { createSazitoClient } from '@sazito/client-sdk';
export const sazito = createSazitoClient({
domain: process.env.NEXT_PUBLIC_SAZITO_DOMAIN!,
});// app/[lang]/(home)/page.tsx
'use client';
import { useEffect, useState } from 'react';
import { sazito } from '@/app/lib/sazito-client';
export default function Example() {
const [data, setData] = useState<any>(null);
useEffect(() => {
sazito.menu.getHeaderMenu().then((res) => setData(res.data ?? null));
}, []);
return <pre>{JSON.stringify(data, null, 2)}</pre>;
}Type Details
The following tables are generated from SDK TypeScript types and include nested object fields.
MenuItem
Source: src/types/menu.ts
| Field | Type | Required |
|---|---|---|
name | string | Required |
url | string | Required |
children | MenuItem[] | Required |
MenuTree
Source: src/types/menu.ts
| Field | Type | Required |
|---|---|---|
id | number | Required |
identifier | string | Required |
treeStructure | { nodes: MenuNode[]; } | Required |
treeStructure.nodes | MenuNode[] | Required |
MenuNode
Source: src/types/menu.ts
| Field | Type | Required |
|---|---|---|
entityType | 'product_category' | 'product' | 'cms_page' | 'blog_page' | 'url' | Required |
entityId | number | null | Required |
entity | { id?: number; name?: string; // For products/categories title?: string; // For CMS/blog pages url?: string; enabled?: boolean; } | Optional |
entity.id | number | Optional |
entity.name | string | Optional |
entity.title | string | Optional |
entity.url | string | Optional |
entity.enabled | boolean | Optional |
details | { title?: string; isTitleDefault?: boolean; url?: string; // For entityType "url" name?: string; // For entityType "url" entityType?: string; includeChildren?: boolean; // For product_category } | Optional |
details.title | string | Optional |
details.isTitleDefault | boolean | Optional |
details.url | string | Optional |
details.name | string | Optional |
details.entityType | string | Optional |
details.includeChildren | boolean | Optional |
children | MenuNode[] | Required |