ClicktermDialog controls the clickwrap consent dialog shown to end users. It provides methods to show a clickwrap for acceptance and to display previously accepted content.
Access
const { ClicktermDialog } = window.Clickterm;
Methods
show
Displays a clickwrap dialog to the end user. If the user has already accepted the latest effective major version, the promise resolves immediately without showing the dialog.
ClicktermDialog.show(options, config?)
Parameters:
| Parameter | Type | Required | Description |
|---|
options | ShowOptions | Yes | Dialog options (see below) |
config | DialogConfig | No | Dialog configuration (see below) |
ShowOptions:
| Field | Type | Required | Description |
|---|
endUserId | string | Yes | Your identifier for the end user (max 256 chars) |
clickwrapTemplateId | string | Yes | Template ID from the ClickTerm dashboard |
templatePlaceholders | object | No | Key-value pairs for placeholder substitution |
language | string | No | Language code (e.g., "en", "de"). Falls back to the configured default |
DialogConfig:
| Field | Type | Default | Description |
|---|
disableClose | boolean | false | Prevent the user from closing the dialog without accepting |
Returns: Promise<ShowResult>
The result object contains the Signature that should be sent to your backend for verification.
Example:
ClicktermDialog.show({
endUserId: "user-123",
clickwrapTemplateId: "YOUR_TEMPLATE_ID",
templatePlaceholders: {
fullName: "Alice Example",
email: "[email protected]",
company: "Acme Corp",
},
language: "en",
}, {
disableClose: true,
}).then((result) => {
// Send result.clicktermSignature (the Signature) to your backend
console.log("Signature:", result.clicktermSignature);
}).catch((error) => {
console.error("Error:", error);
});
Requests to show a clickwrap are not counted toward billing. Only the
verification step (POST /clickwrap/verify) is billed.
showAcceptedContent
Displays the previously accepted clickwrap content to the user. Use this when you want to let users review what they agreed to.
ClicktermDialog.showAcceptedContent(options)
Parameters:
| Field | Type | Required | Description |
|---|
endUserId | string | Yes | The end user identifier |
clickwrapTemplateId | string | Yes | Template ID |
Returns: Promise<AcceptedContentResult>
Example:
ClicktermDialog.showAcceptedContent({
endUserId: "user-123",
clickwrapTemplateId: "YOUR_TEMPLATE_ID",
}).then((result) => {
console.log("Accepted content:", result);
}).catch((error) => {
console.error("Error:", error);
});
The accepted content dialog only appears if the user has an accepted and verified event.