Skip to content
Twilight React Playground
ثيم رائدaren

Data & API

./api/types./api/client./api/store./api/translations./api/cart./api/product./api/home./api/brands./api/loyalty./api/order./api/category./api/page./api/menu./api/notification./api/wishlist./api/user./api/profile./api/apps

Typed functions and TanStack Query options for reading store data from the Salla API.

When a page needs data (a product, a category, the menu), it asks the Salla API through these modules. Each one is a set of plain async functions plus ready-made query options for TanStack Query.

Entries

product.list

Lists products from any source (latest, offers, a category, a brand, a search) with page size, sort, filters and cursor pagination.

objectBeginnerlive demo
product.find

Fetches one product with everything a product page needs: images, options, SKUs, brand, tags, rating and bundle contents.

objectBeginnerlive demo
category

Reads the store's category tree, or a single category, from the Salla API; the tree is cached per branch.

objectBeginnerlive demo
menu

Fetches the header and footer menus the merchant built in the Salla dashboard, in the language of the current page.

objectBeginnerlive demo
store

Loads the store, its theme, languages and currencies in one call: the same call the root loader makes before every page.

objectBeginnerlive demo
page

Loads one of the merchant's own content pages, such as About us or the privacy policy, by its page id.

objectBeginnerlive demo
brand

Reads the store's brands, or a single brand, for brand pages and brand-filtered product lists.

objectBeginnerlive demo
home

Fetches the blocks the merchant arranged on the home page, in order, each with its own settings.

objectBeginnerlive demo
cart

Reads a cart by its id and returns it with the loyalty prize and gift details merged into the cart object.

objectBeginnerlive demo
user

Fetches the signed-in customer's profile; for a guest, or after any failure, it resolves to null instead of throwing.

objectBeginnerlive demo
order

The signed-in customer's orders: a filterable list, one order's details, its shipments and ratings, and the thank-you text after checkout.

objectBeginnerlive demo
wishlist

Lists the products the signed-in customer saved, one numbered page at a time; saving and unsaving stay with the Salla SDK.

objectBeginnerlive demo
notification

Reads the signed-in customer's notifications and marks one of them, or all of them, as read.

objectBeginnerlive demo
loyalty

Reads the store's loyalty program (ways to earn points, prizes) and the signed-in customer's points balance.

objectBeginnerlive demo
profile

Two writes on the signed-in customer's account: save one on/off preference, or delete the account.

objectBeginner
translations

Downloads Salla's shared translations file, every storefront message in Arabic and English, which the engine's translate function reads.

objectAdvancedlive demo
apps

Reads the Salla apps installed on the store: the code each one wants on the page, and each app's public settings.

objectAdvancedlive demo
api

The HTTP client behind every engine API module: ky, pointed at the Salla Store API, adding store, language, version, token and branch headers.

objectAdvancedlive demo
cdn

A bare ky client for Salla's public CDN at cdn.salla.network; it sends no store, language or customer headers.

objectAdvanced
getAuthToken

Returns the customer's login token the way the API client finds it, or null for a guest; use it to switch customer-only queries on.

functionAdvancedlive demo
getActiveScope, getActiveScopeId

Return the store branch (scope) the shopper picked, or null; the API client sends it, and scope-sensitive query keys include it.

functionAdvancedlive demo
resolveStoreIdentifier

Decides which store the current request is about: the explicit value, the preview request, the URL, the server render or the host.

functionAdvancedlive demo
STORE_IDENTIFIER_HEADER

The name of the store-identifier header, which tells the Salla API which store a request is about.

constantAdvanced
Product preview cache

The list-card cache that lets a product's details paint at once from the card you already have, before the full details arrive.

functionAdvancedlive demo
shouldDehydrateQuery, isProductPreviewQuery

The engine's rule for which cached queries travel inside server-rendered HTML: successful and still-loading ones, never list-card previews.

functionAdvancedlive demo
PaginatedResult, Pagination

The shared pagination shapes: the API's cursor block, and the { items, next } result that list functions return.

interfaceAdvanced

Also exported here

These exports have no page of their own yet. Their signatures, straight from the engine's type declarations, are in the complete list.

ExportKindImport path
ProductListFilterstype@salla.sa/twilight-theme-engine/api/product
ProductListFilterValuetype@salla.sa/twilight-theme-engine/api/product