Skip to main content
End users must accept Squire’s Terms & Conditions before you can start recording a consultation. The SDK provides a dedicated method to check the acceptance status, retrieve the document URL, and programmatically record acceptance — so you can build this flow directly into your EHR’s login or onboarding screen.

Acceptance flow

1

Retrieve T&C document info

After initializing the SDK, fetch the current Terms & Conditions document for the authenticated user:
const terms = await squire.getTermsAndConditionsDocumentInfo();
2

Check acceptance status

Check whether the user has already accepted the current version:
if (terms.isAccepted) {
  // The user has accepted. Proceed to start consultations.
  return;
}

// Otherwise, display the document and prompt the user to accept.
3

Display the document

Use terms.documentUrl to show the document to the user. You can open it in a new tab:
<a id="terms-link" target="_blank">View Terms &amp; Conditions</a>
document.getElementById('terms-link').href = terms.documentUrl;
Alternatively, embed the document in an iframe for an in-app experience:
<iframe id="terms-frame" style="width:100%;height:500px;"></iframe>
document.getElementById('terms-frame').src = terms.documentUrl;
4

Record acceptance

When the user clicks your accept button, call terms.accept():
const acceptButton = document.getElementById('accept-terms');

acceptButton.addEventListener('click', async () => {
  await terms.accept();
  console.log('Terms accepted successfully.');
  // Proceed to enable consultation recording.
});

Handling T&C version updates

When Squire publishes a new version of the Terms & Conditions, getTermsAndConditionsDocumentInfo() automatically returns the new version with an updated documentUrl and isAccepted set to false. Users who accepted a previous version must accept the new one before they can record again. Run the same acceptance flow described above whenever isAccepted is false.

API reference

getTermsAndConditionsDocumentInfo()

Returns a promise that resolves with information about the current Terms & Conditions document.
PropertyTypeDescription
uuidstringUnique identifier of the T&C document version
documentFilenamestringFilename of the T&C document
documentUrlstringURL where the T&C document can be downloaded or displayed
createdDtDateDate the document version was created
acceptedDtDate | nullDate the user accepted the terms, or null if not yet accepted
isAcceptedbooleanWhether the current user has accepted this version
accept()() => Promise<void>Records the user’s acceptance of the current document