Skip to main content

TypeScript support

As it is mentioned on the Intro page, Autograph client is written with TypeScript, which means it fully leverages its possibilities, like config validation and autocomplete in your IDE:

Docusaurus themed imageDocusaurus themed image

How to use

The package comes prebundled with all types, so you don't need to do anything additional, to make it work in TypeScript app. Just import it as usual:

import Autograph from 'autograph-client'

and you are good to go!

Exported types

AutographClientConfig

This is the config object for client, that needs to be provided when calling render instance method.

fieldtyperequired?accepted values
apiKeystringyesYour Autograph API key.
appModeAutographAppModeyesSee here.
appNamestringnoAny string, this is how client web component tag will be named. Defaults to "autograph-client".
contactsConfigContact[]noArray of objects to append into recipients list of a signature request. See here.
containerElementHTMLElementyesAny block-like HTML element.
existingSignatureRequestIdstringnoPass existing signature request id alongside appMode as prepareDocument to prepare document with it, process will skip the Select document step.
existingSignatureTemplateIdstringnoPass existing signature template id alongside appMode as createTemplate to prepare document with it, process will skip the Select document step.
fileUploadServicesobjectnoOptional configuration for cloud storage services if you want them enabled. More on this here.
getTemplatesFunction(templateType: TemplateType) => Promise<Template[]>noOptional function which returns a promise that resolves with an array of Templates. Choose from Templates button will be rendered according to the presense of this field. Will be called with TemplateType as an argument.
getContactsFunction(searchValue: string) => Promise<{id: string, name: string, email: string }[]>noOptional function which returns a promise that resolves with an array of contacts. That array will be used for autocompleting name field on the Add recipients step. Will be called with current name input string value.
signFileIdstringdependsRequired, if appMode === 'sign', otherwise can be undefined.
templateIdstringdependsRequired, if appMode === 'prepareDocumentWithTemplate', otherwise can be undefined.
signatureRequestTypestringdependsRequired, if appMode === 'prepareDocumentWithTemplate', otherwise can be undefined.
localeAvailablelocalesnoSee here.
themeAutographClientThemeConfignoSee here.
tokenstringyesJWT of a user.
inPersonEmailstringnoEmail of a user to be used in the in-person signing.
inPersonTokenstringnoToken of a user to be used in the in-person signing mode.

AutographAppMode

String union type, consists of possible app modes:

createTemplate
prepareDocument
prepareDocumentWithTemplate
sign

AutographClientEventType

String union type, consists of possible client events:

auth-error
document-declined
document-prepared
document-signed
general-error
general-exit
general-success
template-prepared

AutographClientEventPayloads

Object-like type, containing all payloads for each event respectively. Please refer to the Events page for details about every event and its payload.

AutographClientThemeConfig

Optional object-like type, containing configuration for theming. Currently we support only setting primary color via primaryColor property. It may contain a string representing any color in any form, that can be put into CSS variable: color name, hex, rgb, hsl and so on. Defaults to #2265D2 internally.

Template

If you provide getTemplatesFunction, then it should return a promise that resolves with an array of objects that match this interface:

fieldtyperequired?
createdAtstringyes
namestringyes
templateIdstringyes

AvailableLocales

String union, representing locales that are supported within the client.

ConfigContact

An object with string fields: email and name:

{
name: 'John Doe',
email: 'john@doe.com'
}

TemplateType

Enum with the following values:

Standard = 'STANDARD'
Bulk = 'BULK'
Collaborative = 'COLLABORATIVE'