UI Widgets/Installation

Installation Guide

Set up the Agent SDK and dependencies in your application

Prerequisites

Before installing the UI Widgets SDK, ensure you have completed the following prerequisites.

1 Eureka Preparation

  • Tenant (company) created in Eureka backend with tenant ID provided
  • JWT authentication enabled for your tenant
  • Public-private key pair generated with public key provided to you
  • IP whitelist configured with your environment's fixed IP address
  • OpenAPI capacity configured according to your purchased package

2 Your Preparation

  • Obtain public key and company ID from Eureka
  • Provide your environment's IP address to Eureka for whitelist configuration
  • Ensure you can retrieve the currently logged-in user's email from your system

Step 1: Include Dependencies

Add the required JavaScript libraries to your HTML page. The SDK requires JSEncrypt for RSA encryption.

HTML
<!-- Include JSEncrypt encryption library -->
<script src="https://unpkg.com/jsencrypt@latest/bin/jsencrypt.min.js"></script>

<!-- Include Eureka Agent SDK -->
<script src="https://openapi-embed.patsnap.com/agent-sdk/agent-sdk.umd.js"></script>

Note: Replace the SDK URL with the actual URL provided by Eureka.

Step 2: Verify Installation

After including the scripts, verify that the SDK is loaded correctly by checking for the global object.

<script>
  // Verify SDK is loaded
  if (window.PatsnapAgentSDK) {
    console.log('Agent SDK loaded successfully');
    console.log('Available agents:', window.PatsnapAgentSDK.AGENT_NAME);
  } else {
    console.error('Agent SDK failed to load');
  }
</script>

Next Steps

Now that the SDK is installed, proceed to the Configuration guide to set up authentication and initialize your first widget.