Terms & Conditions
Before using the SDK’s transcribe functionality, end users must accept the Terms & Conditions. The SDK provides useful methods to check the acceptance status and handle the acceptance flow.
Usage
Check terms & conditions status
After initializing the Squire SDK, retrieve the Terms & Conditions document information for the current user:
const terms = await squire.getTermsAndConditionsDocumentInfo();This document exposes properties such as isAccepted, documentUrl, and the method accept() to handle the acceptance flow.
Verify acceptance
Validate if the user has already accepted the Terms & Conditions by checking the isAccepted property:
if (terms.isAccepted) {
console.log('All good, the Terms & Conditions have already been accepted.');
return;
}Display a terms & conditions document
In case the user has not yet accepted the Terms & Conditions, you should display the document to them. The documentUrl property provides a link to the Terms & Conditions document, which can be displayed in your application.
You can use a simple link to open the document in a new tab:
<a href="" id="terms-link" target="_blank">
View Terms & Conditions
</a>const termsLink = document.getElementById('terms-link');
termsLink.href = terms.documentUrl;Alternatively, you can embed the document in an iframe.
Handle acceptance
Handle the accept button click:
const acceptButton = document.getElementById('accept-terms');
acceptButton.addEventListener('click', async () => {
await terms.accept();
console.log('Terms accepted successfully');
});Handling Updates
When a new version of the Terms & Conditions is available, the SDK will automatically return the new version with updated documentUrl and isAccepted properties. If the user has already accepted the previous version, they will need to accept the new version to continue using the transcribe functionality.
API Reference
getTermsAndConditionsDocumentInfo()
Returns information about the current Terms & Conditions document.
Return Value
Returns a promise that resolves to an object with the following properties:
| Property | Type | Description |
|---|---|---|
uuid | string | Unique identifier of the T&C document |
documentFilename | string | Filename of the T&C document |
documentUrl | string | URL where the T&C document can be downloaded |
createdDt | Date | Creation date of the T&C document |
acceptedDt | Date, null | Date when terms were accepted, or null if not accepted |
isAccepted | boolean | Whether the terms have been accepted |
accept() | function | Method to accept the terms |