The @laioutr-app/battery-included package integrates BatteryIncluded into a Laioutr-powered Nuxt app. It uses the BatteryIncluded API for full-text product search (browse), suggested search (suggest and highlights), and product recommendations. The package registers with the Laioutr orchestr (queries, links, component resolvers) and exposes canonical types for ProductSearchQuery, SuggestedSearchSearchQuery, SuggestedSearchEntriesLink, SuggestedSearchEntry, and a custom ProductRecommendation link and resolver.
BatteryIncluded indexes your catalog (e.g. from Shopify or another commerce app); this package does not provide cart, menu, or category. It adds search, autocomplete/suggest, and “recommended for you” style links. The module installs @laioutr-core/frontend-core, @nuxt/image, and @laioutr-app/shopify on prepare; use Battery Included alongside a commerce app (e.g. Shopify) so product data is available for search and recommendations.
The module expects configuration under the key @laioutr-app/battery-included in nuxt.config.ts (or via runtimeConfig). Two options are required; one is optional.
| Option | Type | Description |
|---|---|---|
baseURL | string | BatteryIncluded API base URL. Default: https://api.batteryincluded.io. |
collection | string | BatteryIncluded collection identifier. Used in all API paths: /api/v1/collections/{collection}/.... |
apiKey | string | API key for authentication. Sent as X-BI-API-KEY header on every request. Keep secret and only use on the server (private runtime config). |
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@laioutr-app/battery-included', '@laioutr-core/orchestr'],
'@laioutr-app/battery-included': {
baseURL: process.env.BATTERY_INCLUDED_BASE_URL ?? 'https://api.batteryincluded.io',
collection: process.env.BATTERY_INCLUDED_COLLECTION!,
apiKey: process.env.BATTERY_INCLUDED_API_KEY!,
},
});
Use environment variables for collection and apiKey in production; do not commit the API key.
baseURL, collection, apiKey, and locale (derived from clientEnv.locale, e.g. first part before -). All requests are sent to /api/v1/collections/{collection}{endpoint} with X-BI-API-KEY and v[locale] query param. The SDK is passed into the orchestr context as batteryIncludedClient.price:asc, price:desc) into context; used by ProductSearchQuery in the response.The package implements Laioutr’s canonical search and suggested-search types plus a custom recommendations link. The following lists what is available; for exact types and payloads, refer to @laioutr-core/canonical-types and the package source.
query. Uses browse API with pagination, sort, and filters (mapped via orchestr-helper facets). Returns ids (document ids from hits), total (found), availableFilters, availableSortings, sorting.query. If query is empty, calls highlights and returns suggestion id with search highlights as query suggestions (link to ProductSearchPage with q: ""). If query is set, calls suggest and builds suggestions from query-completion, document (product), and facet (category) hits. Stores result in suggestionResultsFragmentToken. Returns id (e.g. search-suggest:{query}). Order: 2.battery-included/product/recommendations. Source: Product. Target: ProductRecommendation. Resolves product IDs to recommendation document IDs. For each source id calls recommend(id). Stores responses in recommendationsToken. Returns links: [{ sourceId, targetIds }].also | together | related). Maps each recommendation response to an entity with id: res.document.id, relation: res.type.v[locale] on every request; ensure your BatteryIncluded collection supports the locales you use in clientEnv.locale.This package does not set or read any cookies. All calls are stateless per request using the API key and collection.
@laioutr-app/battery-included (e.g. from env).Adobe Commerce
Developer documentation for the Laioutr Adobe Commerce app package. Connect your Nuxt frontend to Adobe Commerce (Magento) via the GraphQL API.
Cookiebot
Developer documentation for the Laioutr Cookiebot app package. Add Cookiebot cookie consent management to your Nuxt app via the Laioutr consent store.