The @laioutr-app/emporix package integrates a Laioutr-powered Nuxt app with Emporix. It uses the Emporix API (categories, products, search, prices, availability, cart). The package registers with the Laioutr orchestr (queries, actions, links, component resolvers, query template provider), and maps Emporix media to the canonical media shape with provider emporix for use with Nuxt Image.
Auth is anonymous by default: if no accessToken cookie is present, the SDK calls the anonymous login endpoint and sets the token in a cookie so subsequent requests (cart, product, category) use the same session. The package also supports admin (client-credentials) auth for future use. Cart and catalog are driven by the Emporix tenant and site (e.g. siteCode: "main").
The module expects configuration under the key @laioutr-app/emporix in nuxt.config.ts (or via runtimeConfig). Four options are required for the API; two are required for category listing with filters and sortings.
| Option | Type | Description |
|---|---|---|
baseURL | string | Emporix API base URL. Default: https://api.emporix.io. |
clientId | string | API client ID. Sent as client_id and used for anonymous login and admin token. |
clientSecret | string | API client secret (e.g. for admin client_credentials). Keep this secret and only use it on the server. |
tenant | string | Emporix tenant identifier. Default: laioutr. Used in all API paths. |
availableFilters | Array<AvailableFilter> | Filters offered for product listing (from @laioutr-core/orchestr/types). Passed through to query results. |
availableSortings | Array<AvailableSorting> | Sort options for product listing. Passed through to query results. |
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@laioutr-app/emporix', '@laioutr-core/orchestr', '@nuxt/image'],
'@laioutr-app/emporix': {
baseURL: process.env.EMPORIX_BASE_URL ?? 'https://api.emporix.io',
clientId: process.env.EMPORIX_CLIENT_ID!,
clientSecret: process.env.EMPORIX_CLIENT_SECRET!,
tenant: process.env.EMPORIX_TENANT ?? 'laioutr',
availableFilters: [/* ... */],
availableSortings: [/* ... */],
},
});
Use environment variables for clientId and clientSecret in production; do not commit them.
baseURL, clientId, clientSecret, and tenant. Every orchestr request runs assertIsAuthOrAnon({ event }): if the request has no accessToken cookie, the SDK calls /customerlogin/auth/anonymous/login, then sets the returned access_token in a cookie (accessToken, httpOnly, secure, sameSite: lax, maxAge: expires_in). The same token is used for cart and catalog APIs. The SDK is passed into the orchestr context as emporixClient.assertIsAdminAuth()). Admin auth would use client_credentials against /oauth/token and cache the token (e.g. in userland cache) for admin-only operations.The package implements Laioutr’s canonical ecommerce types via the orchestr. The following lists what is available; for exact types and payloads, refer to @laioutr-core/canonical-types and the package source.
emporixClient.assertHasCart({ siteCode: "main" }) (GET carts with create: true). Returns { id: cart.id }.alias === "root" calls listCategories({}) and filters to categories without parentId; otherwise calls listCategories({ parentCategoryId: alias }). Results are stored in categoriesPassthroughToken. Returns { ids, total }.searchProducts({ q: \code:${slug}` })and returns`.ids, availableFilters, availableSortings. Throws CategoryNotFoundError if category is missing.categoryId. Uses listCategoryAssignments and searchProducts, stores products in passthrough, returns ids, availableFilters, availableSortings.type === "product" are resolved by product ID via searchProducts; then retrieveProductsPrices is called for those IDs. Throws ProductsNotFoundError if products or price info are missing. Calls addItemToCart with item YRN, price (priceId, effectiveAmount, originalAmount, currency), quantity, and siteCode: "main".sourceId (product id) → targetIds (variant product ids).alias: "root" (label "Root") and one per category from listCategories (input alias: category.id, label category name). Note: implementation may use listCategories({ onlyRoots: false }); confirm SDK supports the same parameters in your Emporix API version.expandCalculation: true.Product and variant media from Emporix are mapped to the canonical MediaImage type with provider: "emporix" and sources[].src set to the media URL. The module installs @nuxt/image on prepare; use an Emporix Nuxt Image provider if your setup requires it to serve or transform these URLs.
main). Ensure the tenant has the correct site configured.| Cookie | Purpose |
|---|---|
| accessToken | Emporix session access token (anonymous or authenticated). Set after anonymous login; used for cart and catalog API calls. |
Without this cookie, the first request triggers anonymous login and sets it; subsequent requests reuse it until expiry.
@laioutr-app/emporix, @laioutr-core/orchestr, and @nuxt/image to Nuxt modules.baseURL, clientId, clientSecret, tenant, availableFilters, availableSortings under @laioutr-app/emporix (e.g. from env).provider: "emporix" for product/variant images; configure Nuxt Image with an Emporix provider if required.Commercetools
Developer documentation for the Laioutr Commercetools app package. Connect your Nuxt frontend to Commercetools via the Platform API with anonymous or client-credentials auth.
Klaviyo
Developer documentation for the Laioutr Klaviyo app package. Integrate Klaviyo newsletter signup into your Nuxt app via the Klaviyo Client API.