The React Native SDK exposes two functions for presenting clickwrap content: show() (request consent) and showAcceptedContent() (re-display a previously accepted agreement). Both return Promises and use the native iOS / Android clickwrap dialogs under the hood.
Methods
show
function show(request: ClickwrapTemplateRequest): Promise<string | null>;
Fetches the current effective template, presents the clickwrap dialog, and resolves with the resulting Signature when the user accepts or declines. If the end user has already accepted the latest major version, no dialog is shown and the promise resolves with null.
ClickwrapTemplateRequest fields:
| Field | Type | Required | Description |
|---|
clickwrapTemplateId | string | Yes | Template ID from the ClickTerm dashboard. |
endUserId | string | Yes | Your identifier for the end user (max 256 chars). |
templatePlaceholders | { ...standardFields, customPlaceholders?: Record<string, string> } | null | No | Structured placeholder object. Pass null or omit if not needed. |
language | string | Yes | Language code (e.g. "en"). |
Example:
import * as Clickterm from '@clickterm/react-native-sdk';
import type { ClickwrapTemplateRequest } from '@clickterm/react-native-sdk';
const request: ClickwrapTemplateRequest = {
clickwrapTemplateId: 'YOUR_TEMPLATE_ID',
endUserId: 'user-123',
templatePlaceholders: {
fullName: 'Alice Example',
email: '[email protected]',
company: 'Acme Corp',
customPlaceholders: {
region: 'EMEA',
},
},
language: 'en',
};
try {
const signature = await Clickterm.show(request);
if (signature === null) {
// User already accepted the latest major version — no dialog shown
return;
}
// Send the Signature to your backend for verification
await sendToBackend(signature);
} catch (error) {
console.error('show() failed', error);
}
show() resolves with null when the user has already accepted the latest major version — no dialog is presented and no new Signature is generated. This mirrors the Android SDK’s null Signature semantics.
showAcceptedContent
function showAcceptedContent(
request: ClickwrapAcceptedAgreementRequest
): Promise<ClickwrapTemplateContent>;
Re-displays a previously accepted agreement. Resolves with the stored ClickwrapTemplateContent for the most recent acceptance.
ClickwrapAcceptedAgreementRequest fields:
| Field | Type | Required | Description |
|---|
clickwrapTemplateId | string | Yes | Template ID from the ClickTerm dashboard. |
endUserId | string | Yes | Your identifier for the end user. |
ClickwrapTemplateContent fields:
| Field | Type | Description |
|---|
clickwrapTemplateId | string | The template’s ID. |
clickwrapTemplateVersion | number | Major version of the accepted content. |
clickwrapTemplateVersionMinor | number | Minor version of the accepted content. |
title | string | null | Template title (may be unset). |
content | string | Rendered HTML content of the agreement. |
eventAcceptedTimestamp | string | null | ISO-8601 timestamp of the acceptance event. |
templateLastUpdatedTimestamp | string | null | ISO-8601 timestamp of the template’s last update. |
resolvedLanguage | string | null | Language code the content was resolved into. |
Example:
import * as Clickterm from '@clickterm/react-native-sdk';
import type { ClickwrapAcceptedAgreementRequest } from '@clickterm/react-native-sdk';
const request: ClickwrapAcceptedAgreementRequest = {
clickwrapTemplateId: 'YOUR_TEMPLATE_ID',
endUserId: 'user-123',
};
try {
const content = await Clickterm.showAcceptedContent(request);
console.log(`Accepted v${content.clickwrapTemplateVersion}.${content.clickwrapTemplateVersionMinor}`);
} catch (error) {
console.error('showAcceptedContent() failed', error);
}
Only works if the user has an accepted and verified event for this template.