Skip to main content

Onboarding Quotes

General Overview​

These features allow users to view available quotes for a chosen address from the postcode lookup.

Add the following environment variables to your .env.local file.

note

The NEXT_PUBLIC_POSTCODE_REGEX value shown below is an example for UK postcodes. Update this regex to match the postcode format for your market.

NEXT_PUBLIC_BRAND_CODE="ENERGY_PROVIDER"
NEXT_PUBLIC_ACCOUNT_TYPE="DOMESTIC"
NEXT_PUBLIC_PAYMENT_METHOD="DIRECT_DEBIT"
NEXT_PUBLIC_POSTCODE_REGEX=/^[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}$/i

Address lookup​

The address lookup is a feature that allows users to search for an address by postcode.

Tariff selection​

The tariff selection is a feature that allows users to select a tariff from the list of available tariffs.

On Continue, the tariffs step persists the quote reference (OnboardingKey.QuoteCode) and the selected tariff IDs into the wizard state so downstream steps can reference the same quote. The selectProducts mutation that links the quote to the chosen products is fired later, on the Review step submit (see below).

Quote summary (Review)​

The Review step shows a summary card of the tariffs the customer was quoted, fetched from the quoteRequest query using the persisted quote code. Amounts are formatted through formatCurrencyFromAPI so the display respects NEXT_PUBLIC_CURRENCY / NEXT_PUBLIC_CURRENCY_IN_MINOR_UNIT. On submit, the Review step calls selectProducts via POST /api/org/select-products to link the persisted quote to the chosen products before the flow completes.

Sign-up mutations not yet wired

The Foundation Review step currently stops after selectProducts and redirects to /onboarding/success. The initializeUser, initializeAccount, and enrollment mutations have scaffolding in place — client hooks (useInitializeUser, useInitializeAccount, useEnrollment), org-scoped server routes at /api/org/initialize-user and /api/org/initialize-account, and their GraphQL mutation documents — but nothing imports them into a page or component yet. No Kraken user, account, or enrollment is created when submitting the Foundation Review page as-shipped; the flow is clickable end-to-end for demo purposes.

To finish the sign-up chain, the Review submit needs to call, in order:

selectProducts(quoteCode, quotedProductIds)          // already wired
initializeUser(customerDetails) → userNumber
initializeAccount(userNumber, billingAddress,
supplyPointInfoList) → accountNumber
enrollment(accountNumber, payment, contractIdentifiers)

All inputs already live in the wizard state (personal details, billing address / UPRN, MPAN / MPRN, quote_code, selected quotedProductIds).