Core

createSolvimonCore initialises the SDK once with shared configuration, and gives you back the methods to mount any screen or component.


Overview

Call createSolvimonCore once, typically at app initialisation, and reuse the returned instance across your app. The shared config you pass here applies to every screen and component you mount, so you don’t repeat yourself.

The returned instance exposes two methods:

  • createComponent(id, { container, portalObject, configuration }): mounts a component into a container and returns an unmount function.
  • createScreen(id, { container, portalObject, configuration }): mounts a screen into a container and returns an unmount function.

Initialise

Initialise the core
1import { createSolvimonCore } from '@solvimon/sdk/core';
2
3const solvimon = createSolvimonCore({
4 environment: 'TEST',
5 locale: 'en-US',
6 dateLocale: 'en-US',
7 logLevel: 'info',
8 branding: {
9 colors: {
10 primary: '#1d4ed8',
11 secondary: '#0f172a',
12 },
13 },
14});
15
16// Mount a screen
17const unmount = solvimon.createScreen('checkout', {
18 container: '#sdk-root',
19 portalObject: checkoutPortalObject,
20});
21
22// Mount a component
23const unmount = solvimon.createComponent('invoices-list', {
24 container: '#invoices-root',
25 portalObject: customerPortalObject,
26});
27
28// Unmount when done
29unmount();

Configuration

OptionTypeDefaultDescription
environment'TEST' | 'PRODUCTION''PRODUCTION'The Solvimon environment to connect to. Use 'TEST' during development.
localestringBCP 47 locale code for UI language (e.g. en-US, nl-NL).
dateLocalestringBCP 47 locale code for date formatting. Defaults to locale if not set.
branding.colors.primarystringPrimary brand colour applied to buttons and accents. Accepts any valid CSS colour value.
branding.colors.secondarystringSecondary brand colour. Accepts any valid CSS colour value.
logLevel'debug' | 'info' | 'warn' | 'error''error'Minimum log level for SDK output.
onLog(entry) => voidCustom log handler. Called for every log entry at or above logLevel.
experimentalFeaturesunknown[]Opt in to experimental SDK features. Consult Solvimon before using.