Data & API
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
Lists products from any source (latest, offers, a category, a brand, a search) with page size, sort, filters and cursor pagination.
product.findFetches one product with everything a product page needs: images, options, SKUs, brand, tags, rating and bundle contents.
categoryReads the store's category tree, or a single category, from the Salla API; the tree is cached per branch.
menuFetches the header and footer menus the merchant built in the Salla dashboard, in the language of the current page.
storeLoads the store, its theme, languages and currencies in one call: the same call the root loader makes before every page.
pageLoads one of the merchant's own content pages, such as About us or the privacy policy, by its page id.
brandReads the store's brands, or a single brand, for brand pages and brand-filtered product lists.
homeFetches the blocks the merchant arranged on the home page, in order, each with its own settings.
cartReads a cart by its id and returns it with the loyalty prize and gift details merged into the cart object.
userFetches the signed-in customer's profile; for a guest, or after any failure, it resolves to null instead of throwing.
orderThe signed-in customer's orders: a filterable list, one order's details, its shipments and ratings, and the thank-you text after checkout.
wishlistLists the products the signed-in customer saved, one numbered page at a time; saving and unsaving stay with the Salla SDK.
notificationReads the signed-in customer's notifications and marks one of them, or all of them, as read.
loyaltyReads the store's loyalty program (ways to earn points, prizes) and the signed-in customer's points balance.
profileTwo writes on the signed-in customer's account: save one on/off preference, or delete the account.
translationsDownloads Salla's shared translations file, every storefront message in Arabic and English, which the engine's translate function reads.
appsReads the Salla apps installed on the store: the code each one wants on the page, and each app's public settings.
apiThe HTTP client behind every engine API module: ky, pointed at the Salla Store API, adding store, language, version, token and branch headers.
cdnA bare ky client for Salla's public CDN at cdn.salla.network; it sends no store, language or customer headers.
getAuthTokenReturns 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.
getActiveScope, getActiveScopeIdReturn the store branch (scope) the shopper picked, or null; the API client sends it, and scope-sensitive query keys include it.
resolveStoreIdentifierDecides which store the current request is about: the explicit value, the preview request, the URL, the server render or the host.
STORE_IDENTIFIER_HEADERThe name of the store-identifier header, which tells the Salla API which store a request is about.
Product preview cacheThe list-card cache that lets a product's details paint at once from the card you already have, before the full details arrive.
shouldDehydrateQuery, isProductPreviewQueryThe engine's rule for which cached queries travel inside server-rendered HTML: successful and still-loading ones, never list-card previews.
PaginatedResult, PaginationThe shared pagination shapes: the API's cursor block, and the { items, next } result that list functions return.
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.
| Export | Kind | Import path |
|---|---|---|
ProductListFilters | type | @salla.sa/twilight-theme-engine/api/product |
ProductListFilterValue | type | @salla.sa/twilight-theme-engine/api/product |