This version (v0.7) has not been published to npm yet.
Skip to content

Configuration and branding ​

The config namespace reads what the operator configured: currency, limits and payment methods (config.get), visual identity (config.getBranding), enabled products (config.getProducts) and the sportsbook (config.getSportsbook). Every method is public: it needs no login, sends the token only when there is a session, and answers for the tenant of the request (see Tenant and domains). The support widget, also under config, has its own page: Support (widget).

MethodRouteReturns
config.get()GET /configOperatorConfig: currency, limits, payment methods, captcha, OTP, languages
config.getBranding()GET /config/brandingBranding: name, colors, logos, legal links, contact, PWA
config.getProducts()GET /config/productsProductsConfig: products with route, order and status
config.getSportsbook()GET /config/sportsbookSportsbookConfig: provider and FIRST settings

Operator configuration: config.get ​

ts
import { formatMoney } from '@getenginex/sdk'

const config = await enginex.config.get()

config.currency // { code: 'BRL', symbol: 'R$', name: 'Real brasileiro', decimalPlaces: 2 }
config.languages // ['pt-BR']
config.features.casino // true when the casino is turned on

const pix = config.paymentMethods.find((method) => method.code === 'pix')
if (pix?.supportsDeposit) {
  console.log(`Minimum deposit: ${formatMoney(pix.minDeposit, config.currency, 'pt-BR')}`)
}
  • Money in minor units. limits and the paymentMethods amounts are integers in minor units (1000 is 10.00 BRL with decimalPlaces: 2). Format them with formatMoney and the operator's currency (see Money).
  • limits: minBet/maxBet always come; the deposit and withdrawal limits and fees only come when the gateway identified the operator.
  • captcha: whether sign-up requires a captcha, the provider and its public siteKey (see Sign-up).
  • otp: enabled and the flows that ask for a code (e.g. register, withdraw_money).
  • timezone and defaultLanguage are optional: use them to show dates and pick the first language.

A domain that does not belong to any operator rejects with INVALID_ARGUMENT. Money or a currency outside the format rejects with VALIDATION_ERROR, even with validation: 'warn' (see Response validation).

Branding: config.getBranding ​

ts
const branding = await enginex.config.getBranding()

document.title = branding.operatorName
const root = document.documentElement
for (const [name, value] of Object.entries(branding.colors)) {
  // Colors the operator did not configure come as an empty string: keep the app's default.
  if (value !== '') root.style.setProperty(`--brand-${name}`, value)
}

const logo = document.querySelector<HTMLImageElement>('#logo')
if (logo) logo.src = branding.logos.logoFullDark
FieldWhat it holds
operatorId, operatorCode, operatorName, companyNamewho the operator is (display name and legal name)
colorsthe full palette (primaryColor, backgroundColor, lightPrimaryColor, gradientCta...); a color not configured is ''
logoslogoFullLight (for a light background) and logoFullDark (for a dark background)
legaloptional: termsUrl, privacyUrl, responsibleGamblingUrl, cookiePolicyUrl and licenses
contactoptional: supportEmail, supportPhone and socialLinks (name → URL)
pwaoptional: appName, appShortName and appDescription for the manifest
integrationsoptional: gtmId and the Storyblok ids

Every color key exists in BrandingColors, so branding.colors.primaryColor is typed without optional chaining; check for '' before using a value. legal, contact, pwa and integrations may be absent: read them with ?..

Products: config.getProducts ​

ts
const { products } = await enginex.config.getProducts()

const menu = products
  .filter((product) => product.status === 'active')
  .sort((a, b) => a.displayOrder - b.displayOrder)
  .map((product) => ({ label: product.productName, href: product.routePath, icon: product.icon }))

Each Product has productType (e.g. casino, sportsbook, predictions), routePath, displayOrder, status and enabledFeatures, plus free-form maps (settings, limits in minor units, integrationSettings, featureConfig) whose keys the operator defines. operatorId and operatorCode are absent when the gateway did not identify the tenant. Use getProducts to build the menu and the routes; config.get().features only says which products are on.

Sportsbook: config.getSportsbook ​

ts
const sportsbook = await enginex.config.getSportsbook()

if (sportsbook.enabled && sportsbook.provider === 'first' && sportsbook.config) {
  const { sportsbookUrl, language, currency, liveBettingEnabled } = sportsbook.config
  console.log(sportsbookUrl, language, currency, liveBettingEnabled)
}

config (the FIRST settings: siteId, sportsbookUrl, widgetUrl, language, currency, liveBettingEnabled, cashoutEnabled) only comes for the FIRST provider. Mounting the frame and creating the player's session belong to iGaming: see Sportsbook (FIRST).

Caching ​

The configuration rarely changes. Read it once per app (or per request on the server) and keep it:

  • With TanStack Query, the config.* factories of @getenginex/sdk/query carry a 5-minute staleTime and a public key, shared by every user (see Frameworks).
  • In Next.js, prefetch them in the layout with prefetchEnginex(enginex, (q) => [q.config.get(), q.config.getBranding()]), or cache the call with fetchOptions: { next: { revalidate: 300 } } (see Next.js and Extensibility).
ts
import { createQueries } from '@getenginex/sdk/query'

const q = createQueries(enginex)
q.config.getBranding() // { queryKey: ['enginex', 'public', 'config', 'getBranding'], queryFn, staleTime: 300_000 }

Testing ​

createMockFetch() answers the four routes with a mock operator (BRL, PIX, a casino product and FIRST enabled). Override a route to test another operator:

ts
import { createEnginexClient } from '@getenginex/sdk'
import { createMockFetch, ok } from '@getenginex/sdk/testing'

const enginex = createEnginexClient({
  baseUrl: 'https://gateway.test',
  tenantHost: 'casino.test',
  fetch: createMockFetch({
    routes: { 'GET /api/v1/config/products': () => ok({ products: [] }) },
  }),
})

const { products } = await enginex.config.getProducts() // []

See Testing and mocks.