Consent Module

The Consent module renders a consent form (terms text plus configurable checkboxes) and submits the user's selections. Used to capture optional or required

📘

This guide is specific to Web SDK 2.0. If you are still using 1.x, you can find documentation here. We strongly recommend upgrading - contact your Incode Representative for upgrade information.

The Consent module renders a consent form (terms text plus configurable checkboxes) and submits the user's selections. Used to capture optional or required user consents before downstream modules run.

Follows the form-based pattern, with an additional display state for showing the consent text and checkboxes. See the patterns page for the shared lifecycle.

Tag

<incode-consent> is a standard Web Component. Importing the UI subpath registers the custom element; importing the CSS applies the module's styles.

import '@incodetech/web/consent';
import '@incodetech/web/consent/styles.css';

Properties

PropertyTypeRequiredDescription
configConsentConfigConfiguration options
onFinish() => voidCalled when consent is submitted
onError(error: string) => voidCalled when an error occurs

Configuration

type ConsentConfig = {
  combinedConsents?: string;
  consentId?: string;
};
OptionTypeRequiredDescription
combinedConsentsstringIdentifier for a combined consents bundle from the dashboard. Backend-driven content.
consentIdstringSpecific consent ID to load.

The actual consent text and checkbox definitions come from the backend (fetchCombinedConsent); the config just identifies which bundle to load.

State machine

ConsentState is a discriminated union over status:

StatusDescription
idleInitial state.
loadingFetching consent text + checkbox definitions from the backend.
displayRendering consents; user can toggle checkboxes.
submittingSending the user's selections to the backend.
finishedTerminal.
errorFatal error.

See also