Import Finesse JavaScript API

For gadgets to work properly, they need to import the Finesse JavaScript library hosted on the Finesse server.

Hosting Third-Party Gadgets on Web Server

To import the JavaScript library, the Finesse FQDN needs to be provided inside the import statement. For building the finesse.min.js URL, we need to retrieve the following properties from the gadget preferences:

  1. scheme: https

  2. hostname: FQDN of the Finesse server

  3. port: port of the Finesse service

These properties are inside the gadget preferences as part of Finesse container initialization. In your gadget XML:

  • Define the user preferences that will be used for building the finesse.min.js import statement.

    Code Snippet
    Copy<UserPref name="scheme" display_name="scheme" default_value="" datatype ="hidden"/>
    <UserPref name="host" display_name="host" default_value="" datatype ="hidden"/>
    <UserPref name="hostPort" display_name="hostPort" default_value="" datatype ="hidden"/>
    
  • Import the finesse.min.js file.

    Code Snippet
    Copy<script type="text/javascript" 
        src="__UP_scheme__://__UP_host__:__UP_hostPort__/desktop/assets/js/finesse.min.js">
    </script>

Hosting Third-Party Gadgets on Finesse Server

Third-party gadgets can be hosted on the Finesse server inside the 3rdpartygadget directory. See Upload Third-Party Gadgets.

Since the third-party gadget is hosted on the Finesse server, you can import the Finesse JavaScript API with a relative URL.

Code Snippet
Copy<script type=”text/javascript”src=”/desktop/assets/js/finesse.min.js”></script>