Skip to content

SDK API Reference

This directory contains the public API reference for @mercura-aps/frontend-form-sdk.

The SDK exposes a single global store composed of substores, each responsible for a specific domain. All substores are accessed directly from the store instance.

Substores

SubstoreDescription
addons-substoreLazy-fetched addon resources keyed by registry entry
appearance-substoreLazy-fetched appearance configuration resources
auth-substoreAuthenticated user state
configs-substoreConfiguration lifecycle — add, remove, update, reorder, copy
contact-details-substoreContact form fields — fixed (name/email) and dynamic request fields
finished-configs-substoreRead-only view of all completed configurations with their selections
form-categories-substoreCategory tree navigation and filtering strategies
form-substorePer-config form state — steps, navigation, constraints, prices
forms-substorePaginated forms list with search and category filtering
localization-substoreLanguage and country selection
number-formatter-substorePrice and number formatting utilities
options-substoreLazy-fetched option resources keyed by registry entry
reset-substoreFull store reset with configurable lifecycle callbacks
submit-substoreForm submission, draft save/load, and request copy restore
values-substorePer-config selected values and option quantities

Core types

ApiResource<T>

Returned by all lazy-fetched data properties.

type ApiResource<T, E = Error> = {
data: T | undefined;
isLoading: boolean;
error: E | undefined | null;
};

TConfig

Represents a single user configuration in the session.

type TConfig = {
id: number;
name: string;
formId: number;
formName: string;
status: "in-progress" | "completed" | "incomplete";
configQuantity: number;
missingRequiredElements: TMissingRequiredElement[];
};

TValues / TQuantities

type TValues = Record<string, string[]>; // elementId → selected option IDs/values
type TQuantities = Record<string, Record<string, number>>; // elementId → optionId → quantity