@clickterm/react-native-sdk
React Native SDK for Clickterm clickwrap agreements. It presents native clickwrap dialogs in bare React Native and Expo apps by wrapping the native iOS and Android Clickterm SDKs as an Expo Module — no custom native bridges required.
Requirements
- React Native
0.75+or Expo SDK52+ - iOS
15.0+ - Android
minSdk 24
Installation
npm install @clickterm/react-native-sdk
iOS
Install the CocoaPods dependencies (bare React Native):
cd ios && pod install
Expo projects pick the module up automatically during npx expo prebuild or EAS Build. The native iOS framework is downloaded for you at this step — no manual setup is required.
Android
The native dependency is resolved automatically from Maven Central. Expo prebuilds also enable the core-library desugaring required for Android API 24 and 25 through the package's config plugin.
For a bare React Native app that does not run the config plugin, add the
following to the app module's android/app/build.gradle:
android {
compileOptions {
coreLibraryDesugaringEnabled true
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
}
Expo config plugin
Add the package to your app's plugins array so Expo CLI and EAS Build include it during prebuild:
// app.json
{
"expo": {
"plugins": ["@clickterm/react-native-sdk"]
}
}
Usage
import * as Clickterm from '@clickterm/react-native-sdk';
await Clickterm.initialize('YOUR_APP_ID');
const signature = await Clickterm.show({
clickwrapTemplateId: 'tmpl_abc',
endUserId: 'user_42',
templatePlaceholders: {
fullName: 'Ada Lovelace',
company: 'Analytical Engines Ltd',
customPlaceholders: { customerName: 'Ada' },
},
language: 'en-US',
});
const bundleSignature = await Clickterm.showBundle({
clickwrapBundleId: 'bundle_abc',
endUserId: 'user_42',
templatePlaceholdersByTemplateId: {
tmpl_abc: {
fullName: 'Ada Lovelace',
company: 'Analytical Engines Ltd',
},
},
language: 'en-US',
});
const accepted = await Clickterm.showAcceptedContent({
clickwrapTemplateId: 'tmpl_abc',
endUserId: 'user_42',
});
API
| Function | Returns | Description |
|---|---|---|
initialize(appId, environment?) | Promise<void> | Configure the SDK. environment is 'production' (default) or 'development' — see Platform differences. |
show(request) | Promise<string | null> | Present the clickwrap dialog. Resolves with the signature string, or null if the user has already acted on the agreement. |
showBundle(request) | Promise<string | null> | Present a bundle dialog. Resolves with the bundle signature, or null when every item was already accepted. |
showAcceptedContent(request) | Promise<ClickwrapTemplateContent> | Re-display a previously accepted agreement and resolve with its stored content. |
Request shapes (full TypeScript definitions ship with the package):
ClickwrapTemplateRequest—{ clickwrapTemplateId, endUserId, templatePlaceholders?, language }ClickwrapBundleRequest—{ clickwrapBundleId, endUserId, templatePlaceholdersByTemplateId?, language? }ClickwrapAcceptedAgreementRequest—{ clickwrapTemplateId, endUserId }
showBundle() stays pending while the native dialog offers a retry after a load or submission error. It resolves when the flow succeeds or the bundle is already accepted, and rejects when the user cancels or the flow ends with a terminal error.
Errors
All methods reject with an Error whose code property is one of:
| Code | Meaning |
|---|---|
ERR_CLICKTERM_NOT_INITIALIZED | initialize() was not called first. |
ERR_CLICKTERM_INVALID_ARGUMENT | A required argument is missing or malformed. |
ERR_CLICKTERM_NETWORK | The request could not reach the server. |
ERR_CLICKTERM_HTTP | The server responded with an error status. |
ERR_CLICKTERM_DECODING | The server response could not be parsed. |
ERR_CLICKTERM_USER_CANCELLED | The user dismissed the dialog. |
ERR_CLICKTERM_NO_PRESENTER | iOS: no view controller was available to present from. |
ERR_CLICKTERM_NO_ACTIVITY | Android: no foreground activity was available. |
ERR_CLICKTERM_UNKNOWN | An unexpected error occurred. |
License
MIT
Document delivery recipient
Pass an optional ddRecipient (email, optional fullName) with the template or bundle request.
This is separate from document placeholders. A bundle uses one recipient for the entire delivery email.
Enable agreement email delivery in ClickTerm. Missing or invalid email addresses produce skipped deliveries;
placeholder emails are never used as a fallback. Email supports up to 254 characters and fullName up to 100.
const ddRecipient = { email: '[email protected]', fullName: 'Alice Example' };
await show({ clickwrapTemplateId: 'template', endUserId: 'user', ddRecipient });
await showBundle({ clickwrapBundleId: 'bundle', endUserId: 'user', ddRecipient });
Verification uses the recipient supplied with the request; it cannot add, replace, or clear it.
Do not send ddRecipient at Verify. Verification belongs on your backend; the React Native SDK never
sends backend credentials or calls Verify.
The React Native wrapper does not currently expose deferred identity or activation. Its recipient is supplied
only with the normal template or bundle request.