Documentation
HomeStatusSign in ->
  • Developer guide
  • How it works?
  • Integration Quick Guide
    • Link Flow
    • Embedded Flow
    • Running Workflow
  • Production setup
  • Widget
    • Methods
    • Inline mode
  • Postman Collection
  • Records
    • Introduction
    • Migration Guide: Migrating from Cases to Records
  • TRANSACTIONLINK API
    • API Reference
      • Authentication
      • Cases (deprecated)
      • Resources
      • Parameters
      • Token
      • Link
      • Workflows
      • Records
        • Attachments
    • API Changelog
    • API Versioning
Powered by GitBook
On this page

Was this helpful?

  1. Widget

Methods

Here are the methods available in our JavaScript API

Show

Make TransactionLinks widget reveal itself.

window.transactionlink.open();

Hide

Hide TransactionLink widget.

window.transactionlink.close();

Ready

Trigger a function when a widget is fully loaded.

 window.transactionlink_ready = () => {
      transactionlink.setContext(TOKEN)
      window.transactionlink.open()
}

On

We expose the methods that allow reacting and listening to events emitted from the widget.

Listening for the event about opening widget

transactionlink.on("widget-opened", () => {
    console.log("OPENED")
})

Listening for the event about closing widget

transactionlink.on("widget-closed", () => {
    console.log("CLOSED")
})

Listening for the event about error

transactionlink.on("error", () => {
    console.log("ERROR")
})

Listening for the event about workflow finished

transactionlink.on("workflow-finished", (event) => {
    console.log(event)
})

SetOptions

Use this method to change options of widget.

window.transactionlink.setOptions({
  token: 'exampleToken', // string
  customCSSVariables: {
    '--ccs-variable': value
  }, // object (optional) 
  inline: false // boolean (optional)
});

UnmountWidget

window.transactionlink.unmountWidget()
PreviousWidgetNextInline mode

Last updated 1 year ago

Was this helpful?

Use this method to remove widget from DOM. Once unmounted, reload widget script and repeat initialisation of widget. ()

https://docs.transactionlink.io/docs/js-api#how-to-implement-widget-communication