Nasty Pirate Macaw

    TypeScript icon, indicating that this package has built-in type declarations

    2.2.4 • Public • Published

    LEAP Host SDK

    LEAP Host SDK is a TypeScript library that helps your LEAP apps (formerly known as LEAP addins) communicate easily with LEAP client applications.

    How to install

    This library should be installed as an npm package. We use semantic versioning so the best way to stay up-to-date without backward compatibility concern is to accept minor releases:

    npm i @leapdev/leap-host

    Breaking changes in 2.1.0

    We now support more contexts (cardContext and personContext) so we have renamed some property names to make it make more sense

    //context renamed to leapContext -sdk.context => sdk.leapContext
    //We used to use matterContext to grab the info for a matter
    //we now change it to context which allows more different contexts (matter, card and person)
    sdk.context.matterContext => sdk.leapContext.context
    //some examples

    How to use

    In order to have all the features supported, please develop with the latest LEAP desktop 2.3 or above

    The first thing you have to do is to initialise the SDK

    import { LeapHostSdkFactory } from '@leapdev/leap-host';
    const sdk = LeapHostSdkFactory.getInstance();
    if (!!sdk) {
      sdk.init('LEAP Auth client ID').then(() => {
        //you can start calling APIs

    This init function returns a Promise. We recommend that you do this initialisation once and cache the promise result in memory.

    By awaiting the promise, you then have access to methods that perform actions in the LEAP client applications. Please refer to the API reference for all supported methods.


    Abstracting LEAP context retrieval

    A LEAP app needs to know the context of where its being loaded, e.g. the matterId where it is loaded, which record is being selected (if the current page in LEAP is a list), etc. The LEAP app is expected to retrieve the context object from the hosting LEAP client application. A connection between the LEAP client application and LEAP app is assigned a unique guid. The LEAP app can access this value via "appSessionId" property received.

    The LEAP Host SDK abstracts the context retrieval process by presenting a unified API to the LEAP app. By calling the init function, the LEAP app will have access to the context object as follow.

    import { LeapHostSdkFactory } from '@leapdev/leap-host';
    const sdk = LeapHostSdkFactory.getInstance();
    if (!!sdk) {
      sdk.init().then(() => {

    Obtaining LEAP Auth token

    A LEAP app often needs to call the LEAP API Gateway services. To do so, it needs to obtain a LEAP Auth token. LEAP Host SDK simplifies this process.

    sdk.init('LEAP Auth client ID').then(() => {
      //client Id is not required if you have provided the token in the url
      //or you are developping a trusted app
      if (!!sdk.leapContext.authtoken) {
        //you can check if the SDK is ready by checking if the authtoken has value

    Sending a command to the LEAP client application

    A LEAP client applications (LEAP Desktop / Web / Mobile) accepts certain messages from LEAP apps and act upon them. For example, they can open a document or show a message box.

    The LEAP Host SDK facilitates this process by exposing a set of semantic functions through which the LEAP app can invoke.

    sdk.init('LEAP Auth client ID').then(() => {
      // open a message box in LEAP
      sdk.system.alert({ message: 'Hello, world' });
      // open a matter
      // close the app

    API reference


    Create a time entry

    createTimeEntry(request: CreateTimeEntryRequest): void;

    Create a fee entry

    createFeeEntry(request: CreateFeeEntryRequest): void;

    Create a cost recovery

    createCostRecovery(request: CreateCostRecoveryEntryRequest): void;
    //Request example:
    const request = {

    Create an invoice

    createInvoice(request: CreateInvoiceRequest): Promise<boolean>;

    Create an office receipt

    createOfficeReceipt(request: CreateOfficeReceiptRequest): void;

    Create an office payment

    createOfficePayment(request: CreateOfficePaymentRequest): void;
    //Request example:
    const request = {

    Create an office payment request

    createOfficePaymentRequest(request: CreateNewOfficePaymentRequestRequest): void;

    Create an trust payment request

    createTrustPaymentRequest(request: CreateNewTrustPaymentRequestRequest): void;

    Create an office journal

    createOfficeJournal(request: CreateOfficeJournalRequest): void;

    Create a trust receipt

    createTrustReceipt(request: CreateTrustReceiptRequest): void;

    Create a trust payment

    createTrustPayment(request: CreateTrustPaymentRequest): void;

    Create a trust journal

    createTrustJournal(request: CreateTrustJournalRequest): void;

    Create trust to office

    createTrustToOffice(request: CreateTrustToOfficeRequest): void;

    Reload the financial summary

    reloadFinancialSummary(request: ReloadFinancialSummaryRequest): void;

    Reload the time fee list

    reloadTimeFeeList(request: ReloadTimeFeeListRequest): void;

    Reload the office ledger

    reloadOfficeLedger(request: ReloadOfficeLedgerRequest): void;

    Reload the anticipated payment list

    reloadAnticipatedPaymentList(request: ReloadAnticipatedPaymentListRequest): void;

    Reload the cost recovery list

    reloadCostRecoveryList(request: ReloadCostRecoveryListRequest): void;
    //Request example:
    const request = {

    Reload the trust ledger

    reloadTrustLedger(request: ReloadTrustLedgerRequest): void;

    Reload the controlled money list

    reloadControlledMoneyList(request: ReloadControlledMoneyListRequest): void;

    Reload the power money list

    reloadPowerMoneyList(request: ReloadPowerMoneyListRequest): void;

    Reload the transit money list

    reloadTransitMoneyList(request: ReloadTransitMoneyListRequest): void;

    Open a fee

    openFee(request: OpenFeeRequest): void;


    Evaluate paths

    evaluatePaths(request: EvaluatePathsRequest): Promise<PathResult[]>;
    //Request example:
    const request = {
      "executionContext": {
        "matterGUID": "a4a9a42d-2dd8-48c4-bf06-b213369a5c84"
      "paths": ["matter.clientList.{__id,__className,__fileOrder,__description,personList}", "matter.fileNumber"]
    .then(response =>{
      //handle the response here


    Select card(s) from the list

    selectCard(request?: SelectCardRequest): Promise<Card[]>;

    Create a card

    createCard(): Promise<CreatedCard[]>;

    Open a card

    openCard(request: OpenCardRequest): void;


    Compose an email

    composeEmail(request: CreateEmailRequest): void;

    Create an appointment

    createAppointment(request: CreateAppointmentRequest): void;
    //Request example:
    const request = {
      "startDate": "2020-10-21T05:12:46.472Z",
      "endDate": "2020-10-22T05:13:46.472Z",

    Create a task

    createTask(request: CreateTaskRequest): void;
    //Request example:
    const request = {


    Preview a document

    previewDocument(request: PreviewDocumentRequest): void;

    Preview a Precedent

    previewPrecedent(request: PreviewPrecedentRequest): void;

    Edit a Precedent

    editPrecedent(request: EditPrecedentRequest): void;

    Get the details of a selected precedent

    selectPrecedent(request: SelectPrecedentRequest): Promise<SelectPrecedentResponse>;

    Create a document from a container

    createDocumentFromContainer(request: CreateDocumentFromContainerRequest): void;

    Create a document from a precedent

    createDocumentFromPrecedent(request: CreateDocumentFromPrecedentRequest): void;

    Open a document

    openDocument(request: OpenDocumentRequest): void;
    const request = {

    Reload the document list

    reloadDocumentList(request: ReloadDocumentListRequest): void;


    Share documents

    shareDocuments(request: ShareDocumentsRequest): void;

    Share a folder

    shareFolder(request: ShareFolderRequest): void;

    Share an office statement

    shareOfficeStatement(request: ShareOfficeStatementRequest): void;

    Share a trust statement

    shareTrustStatement(request: ShareTrustStatementRequest): void;


    Open a table

    openTable(request: OpenTableRequest): void;

    Open a matter

    openMatter(request: OpenMatterRequest): void;
    //Request example:
    const request = {

    Select matter(s)

    selectMatter(request?: SelectMatterRequest): Promise<Matter[]>;


    Select staff

    selectStaff(request?: SelectStaffRequest): Promise<Staff[]>;

    MS Teams

    Share a document

    shareDocument(request: ShareDocumentRequest): void;

    Share a matter

    shareMatter(request: ShareMatterRequest): void;

    Request a callback

    shareMatter(request: RequestCallbackRequest): void;


    Select person(s) from the list

    selectPerson(request: SelectPersonRequest): Promise<Person[]>;

    Open a person

    openPerson(request: OpenPerson): void;


    Reload document register list

    reloadDocumentRegisterList(request: ReloadDocumentRegisterListRequest): void;

    Reload power estate list

    reloadPowerEstateList(request: ReloadPowerEstateListRequest): void;


    Get schema list

    getLists(request: GetListsRequest): Promise<SchemaResponse<SchemaList[]>>;

    Customise list

    customiseList(request: CustomiseListRequest): Promise<CustomiseListResponse>;


    Open Twitter window

    openTwitter(request: BaseRequest): void;

    Close the current LEAP app

    close(): void;

    Hide the current LEAP app

    hide(): void;

    Show loading icon in LEAP

    wait(request?: MessageRequest): void;

    Hide loading icon in LEAP

    resume(): void;

    Show a message box in LEAP (Deprecated, replaced with openDialog)

    alert(): void;

    Show an error message in LEAP (Deprecated, replaced with openDialog)

    error(): void;

    Display a message on the dialog box in LEAP

    openDialog(request: DialogRequest): void;

    Open an URL in browser

    openUrl(config: BrowserConfig): void;
    //Request example:
    const config = {
      "url": "",
      "openExternal": false,
      "useNativeLoading": false
      "width": 900,
      "height": 500,
      "minWidth": 800,
      "minHeight": 400,
      "maxWidth": 1000,
      "maxHeight": 600,
      "closeHandler": "jsFunction(parameter)",
      "fixedWindowSize": false,
      "independentWindow": false,
      "windowTitle": "Good day"

    Get host system info

    getSystemInfo(): void;

    Set window title

    setWindowTitle(request: SetWindowTitleRequest): void;

    Register a handler to trigger before closing a window

    onBeforeClose(handler: () => Promise<boolean>): void;

    Send a custom request object to the host

    send(request: object, hasResponse?: boolean): Promise<any>;

    Notify the host system when your app has finished loading (to avoid having different loaders from LEAP and your app)

    finishLoading(): void;




    npm i @leapdev/leap-host

    DownloadsWeekly Downloads






    Unpacked Size

    854 kB

    Total Files


    Last publish


    • ashishguptait
    • leap-ux
    • leaptarah
    • leapdev-automation
    • linhttp
    • daniel-p
    • gavin-smith-leapdev
    • andy-leapdev