Engine: Config
The configuration contract between a shop and the engine: the MagenxConfig types that magenx.config.ts fills in, and EngineConfigProvider / useEngineConfig, which hand it to engine code. Engine code never imports a config file.
Generated from packages/engine/src/config/: 2 files, 26 exported symbols. Signatures and types are shown as written in the source.
@magenxcommerce/engine/config/context
packages/engine/src/config/context.tsxclient
EngineConfigProvider + useEngineConfig
Exposes the engine configuration (Magento connection, feature flags, CMS block identifiers, navigation labels, payment provider) to all client components via React context.
Usage — root layout (server component): import engineConfig from "../../engine.config"; <EngineConfigProvider config={engineConfig}>…</EngineConfigProvider>
Usage — any client component: const { store, features, cms, navigation, payment } = useEngineConfig();
EngineConfigProvider function
EngineConfigProvider({ config, children, }: { config: EngineConfig; children: ReactNode; })useEngineConfig function
useEngineConfig(): EngineConfig@magenxcommerce/engine/config/types
packages/engine/src/config/types.ts
Engine configuration type.
Imported from this file so that consuming packages can reference the type without depending on the storefront's root config file. Shops pass a value that satisfies this interface to <EngineConfigProvider>.
StoreConfig interface
| Member | Type | Description |
|---|---|---|
storeCode | string | Store-view code used when a caller has no locale of its own — the default entry of stores. "" means "send no Store header" (Magento then answers in its own default store view). |
baseUrl | string | |
currency | string | ISO 4217 currency of the default store view. Fallback only: prices carry their own currency, and each store view's comes from Magento's default_display_currency_code. |
catalogPageSize | number | |
searchPageSize | number | |
searchSuggestionsPageSize | number | |
searchMinLength | number | |
sortOptions | ReadonlyArray<{ readonly value: string; readonly label: string }> |
ProductPriceDisplay type
type ProductPriceDisplay = "including" | "excluding" | "none"How catalog / product prices are labelled with respect to tax.
NB: Magento's GraphQL price_range returns a single value already computed for the admin setting; it does NOT expose both the tax-inclusive and tax-exclusive amounts, so only the accompanying note differs. The note text is localized per store-view via the Product.priceTaxIncluded / Product.priceTaxExcluded next-intl messages.
TaxConfig interface
| Member | Type | Description |
|---|---|---|
productPriceDisplay | ProductPriceDisplay | Mirror your Magento admin setting at Stores → Configuration → Sales → Tax → Price Display Settings → "Display Product Prices In Catalog": "including" → prices include tax → cart/checkout show tax-inclusive line totals & subtotal, tax rendered as an "incl." note. "excluding" → prices exclude tax → tax added as a separate line. "none" → no tax note rendered (treated like "excluding" for totals). |
AnalyticsConfig interface
Web analytics configuration. We load Google Tag Manager as the container (configure GA4 and any other tags inside the GTM web UI) and push GA4 ecommerce events to its dataLayer. Tracking is gated by Google Consent Mode v2, wired to the cookie-consent banner's analytics category.
| Member | Type | Description |
|---|---|---|
gtmContainerId | string | Google Tag Manager container ID, e.g. "GTM-XXXXXXX". Empty string disables analytics entirely (the loader and all dataLayer pushes become no-ops), so it is safe to ship before a container exists. |
MapsConfig interface
Third-party map integration used by the Contact-page store locator (and any other map surface). The store addresses themselves come from Magento (storePickupLocations); this only carries the embed credentials.
| Member | Type | Description |
|---|---|---|
googleMapsApiKey | string | Google Maps Embed API key. Empty string disables the embedded map (the store locator then renders the address list + "Open in Google Maps" links only), so it is safe to ship before a key exists. Must be a NEXT_PUBLIC_ var since the embed is rendered in the browser. |
FeaturesConfig interface
| Member | Type | Description |
|---|---|---|
wishlist | boolean | |
reviewsEnabled | boolean | |
relatedProducts | boolean | |
crossSells | boolean | |
recentlyViewed | boolean | |
breadcrumbs | boolean | |
blog | boolean | Enable the blog module integration (blog page, post detail, related posts). |
checkoutFields? | boolean | Order comment and delivery date at checkout (Magenx_CheckoutFieldsGraphQl). Requires the module on the backend; which fields appear is then decided by its admin settings. Off (or absent) means the storefront never queries it. |
freeShipping? | boolean | Free-shipping progress on the product page and cart (Magenx_FreeShippingGraphQl). The threshold, the amount still to go and whether the cart qualifies all come from Magento's Free Shipping carrier settings, so the promise matches the rates charged at checkout. Off (or absent) means the storefront never queries the module and shows no progress indicator. |
vatValidation? | boolean | VAT number on registration, account details and the checkout address forms, the account's business status, and the VAT treatment (reverse charge) on the review step (Magenx_VatValidationGraphQl). Requires the module on the backend, switched on there per website; which countries offer the field also comes from its settings. Off (or absent) means the storefront never queries the module. |
CmsConfig interface
| Member | Type | Description |
|---|---|---|
homepageBlockIdentifiers | ReadonlyArray<string> | |
headerInfoBarBlockIdentifier | string | |
announcementBarBlockIdentifier | string | |
homepageCategoryUrlKeys | ReadonlyArray<string> | |
contactInfoBlockIdentifier | string | |
newsletterContentBlockIdentifier | string | |
categoryPromoBlockIdentifiers | ReadonlyArray<string> | |
brandBlockIdentifierPrefix | string | Prefix for the per-brand hero CMS block identifier looked up on /search when the query exactly matches a manufacturer brand title, e.g. prefix "brand_" + brand "Asus" → block identifier brand_asus. |
homepageBlogCategoryId | string | Blog category ID whose posts are shown in the homepage blog section (4 posts before the footer). Set to an empty string to fetch the latest posts across all categories instead. |
PaymentConfig interface
Checkout renders whatever Magento returns in cart.available_payment_methods, so enabling a method is an admin task, not a storefront one. Stripe is the only gateway with bespoke on-site code (Elements + 3DS); PayPal Express and Mollie leave the storefront for a hosted page and come back. All are keyed off the method code at runtime. The flags below exist because those providers' documents select fields only their Magento module defines, and Magento rejects a whole document over one unknown field — so the storefront must know not to issue them on a store without the module.
| Member | Type | Description |
|---|---|---|
stripe | { /** * Whether the Magento Stripe module is installed. False stops the * storefront issuing `getStripeConfiguration`, which would otherwise fail * schema validation on a store without the module. */ enabled: boolean; } | |
mollie | { /** * Whether Mollie Payments for Magento 2 (`mollie/magento2`) is installed. * False stops the storefront issuing any Mollie document (issuer lookup, * `placeOrder` with `mollie_return_url`, `mollieProcessTransaction`), which * would fail schema validation on a store without the module, and keeps * the Mollie checkout code out of the page entirely (it is a lazy chunk). * It does NOT enable or disable any method — Magento admin owns that. */ enabled: boolean; /** * Card details entered on the checkout page itself (Mollie Components, * js.mollie.com) for `mollie_methods_creditcard`, instead of on Mollie's * hosted card page. Needs a Mollie profile ID configured in Magento; with * none, card entry falls back to the hosted page on its own. */ components: boolean; } |
SeoBehaviorConfig interface
Behavioural / deployment-level SEO concerns (robots, verification tokens, referrer policy, manifest path). Brand identity SEO (authors, og image, application name) lives in SeoBrandConfig.
| Member | Type | Description |
|---|---|---|
referrer | string | |
formatDetection | { email: boolean; address: boolean; telephone: boolean } | |
manifest | string | |
verification | { google: string } | |
robots | { index: boolean; follow: boolean; nocache: boolean; googleBot: { index: boolean; follow: boolean; noimageindex: boolean; "max-video-preview": number; "max-image-preview": "none" | "standard" | "large"; "max-snippet": number; }; } |
SeoBrandConfig interface
Brand identity layer for SEO: authorship, publisher, default OG image, baseline keywords. Behavioural concerns live in SeoBehaviorConfig.
| Member | Type | Description |
|---|---|---|
applicationName | string | |
siteName | string | |
creator | string | |
publisher | string | |
authors | { name: string; url?: string }[] | |
defaultKeywords | string[] | |
ogImage | { url: string; width: number; height: number; alt: string; } |
StoreEntry interface
One entry per Magento store-view exposed by the storefront. The locale string is the URL segment (e.g. /en/, /de/, /fr/) and also drives next-intl routing. storeCode is the Magento store-view code forwarded in the Store GraphQL header. Mark exactly one entry as the default for the locale router and Apollo fallback.
| Member | Type | Description |
|---|---|---|
storeCode | string | |
locale | string | |
default? | boolean | |
storeName? | string | Magento store name — the language switcher's label. |
currency? | string | ISO 4217 display currency of this store view. |
ShippingConfig interface
Shipping & returns messaging shown on the product page (the <ProductShippingInfo> panel below add-to-cart). These are display copy — mirror them to your Magento shipping configuration; they do not drive the actual rates charged at checkout. The free-shipping threshold is not here: it is read from Magento (see FeaturesConfig.freeShipping).
| Member | Type | Description |
|---|---|---|
deliveryEstimate | string | Human-readable delivery window, e.g. "5 - 7 working days". Empty string hides the delivery line. |
returnDays | number | Return window in days shown as "N Days return policy". 0 hides the line. |
AssistantSettings interface
Shopper AI assistant (@magenxcommerce/engine/assistant/*). Optional; omit or set enabled: false to hide the widget and 404 the route. The API key and the session-sealing key are never configured here: they are read from the server environment (ANTHROPIC_API_KEY, ASSISTANT_SEAL_KEY).
| Member | Type | Description |
|---|---|---|
enabled | boolean | |
model | string | Claude model id, e.g. "claude-haiku-5-5". |
effort? | "low" | "medium" | "high" | Reasoning effort. Default "low": the assistant's work is routine lookups. |
persona? | { name?: string; tone?: string } | Name and tone the assistant uses when talking to shoppers. |
policies? | { shipping?: string; returns?: string; contact?: string; other?: string } | Short store policy texts the assistant may quote (shipping, returns, contact). Part of the cached system prompt, so keep them brief and static. |
instructions? | string | Shop-specific notes for the assistant: opening hours, phone number, extra policies, things to say or avoid. Added to the system prompt (cut at 2,000 characters); the assistant's own rules take priority over them. |
pages? | ReadonlyArray<string> | Storefront pages the assistant may link to, besides the built-in ones (contact, guest order, cart, checkout, account pages). Paths without the locale prefix, each with an optional note on what it is for, e.g. "/deals (current offers and discounted products)". Part of the cached system prompt: at most 20 entries of 200 characters are used. |
disabledTools? | ReadonlyArray<string> | Tool names to withhold from the model. Unknown names fail start-up. |
limits? | Partial<AssistantLimits> | Override individual limits; the rest keep their defaults. |
AssistantLimits interface
Hard per-turn and per-conversation budgets.
| Member | Type | Description |
|---|---|---|
maxSteps | number | Model calls per shopper message. |
maxToolCalls | number | Tool calls per shopper message. |
maxMessageChars | number | Characters accepted in one shopper message. |
turnTimeoutMs | number | Wall-clock budget for one shopper message, in milliseconds. |
maxHistoryMessages | number | Shopper messages kept in the conversation history before it is summarised (tool results and context notes do not count). |
maxConversationTokens | number | Total input + output tokens one conversation may spend. |
maxGuestLookups | number | Guest order lookups one conversation may attempt (enumeration guard). |
messagesPerMinute | number | Shopper messages per client per minute. |
maxOutputTokens | number | Output tokens per model call. |
EngineConfig interface
| Member | Type | Description |
|---|---|---|
store | StoreConfig | |
stores | ReadonlyArray<StoreEntry> | Magento store-views available to this storefront (one per locale). |
tax | TaxConfig | |
shipping? | ShippingConfig | Shipping & returns messaging for the product page. Optional; omit to hide the panel. |
analytics? | AnalyticsConfig | Web analytics (GTM container + GA4 ecommerce). Optional; omit to disable. |
maps? | MapsConfig | Map embed credentials (Contact-page store locator). Optional; omit to disable. |
features | FeaturesConfig | |
cms | CmsConfig | |
navigation | NavigationConfig | |
payment | PaymentConfig | |
seoBehavior | SeoBehaviorConfig | |
assistant? | AssistantSettings | Shopper AI assistant. Optional; omit to disable. |
BrandSocialLink interface
| Member | Type | Description |
|---|---|---|
platform | string | |
url | string |
BrandConfig interface
| Member | Type | Description |
|---|---|---|
name | string | |
tagline | string | |
logoSrc | string | |
icons | Metadata["icons"] | |
manifestIcons | MetadataRoute.Manifest["icons"] | |
socialLinks? | ReadonlyArray<BrandSocialLink> |
LayoutConfig interface
Layout values consumed by TypeScript.
Purely visual tokens (colors, type scale, spacing, radii, shadows, container widths, header height) are NOT modelled here: they live as CSS custom properties in src/app/globals.css and are consumed through Tailwind's @theme mapping. Keeping a second, parallel copy in TypeScript produced four config blocks with zero readers whose values had already drifted out of sync with the CSS (e.g. radii.md vs --radius). Only values that real TS code reads belong in this interface.
| Member | Type | Description |
|---|---|---|
productGridColumns | 2 | 3 | 4 | 5 | Product grid columns at the widest breakpoint. Narrower breakpoints step down through the theme's PRODUCT_GRID_COL_CLASSES (src/lib/product-grid-columns.ts), which keys on this value. |
ProductGridSort type
type ProductGridSort = | "position" | "newest" | "price_asc" | "price_desc" | "name_asc"HomepageProductGridConfig interface
| Member | Type | Description |
|---|---|---|
id | string | |
sectionLabel | string | |
title | string | |
categoryUrlKeys | string[] | |
pageSize | number | |
sort | ProductGridSort | |
newOnly | boolean |
HomeTrustBadgeConfig interface
| Member | Type | Description |
|---|---|---|
id | string | |
value | string | |
label | string | |
description | string |
MagenxConfig interface
Unified Magenx storefront configuration: engine behaviour + brand / visual theme rolled into a single object. Each client maintains their own magenx.config.ts at the storefront root.
| Member | Type | Description |
|---|---|---|
brand | BrandConfig | |
seo | SeoBrandConfig | |
layout | LayoutConfig | |
homepageProductGrids | HomepageProductGridConfig[] | |
homeTrustBadges | HomeTrustBadgeConfig[] |