Build Variables

Leopard's build process can be controlled though a commented JavaScript module.

Leopard is configured using /config/default.js which is a commented JavaScript module. You can either directly add your configuration to default.js or to an adjacent local.js which takes precedence and is added to .gitignore. The conversational solutions are configured through the .env.solution.json file in the root of the project. These changes are picked up if you run either npm run serve or npm run build .

Leopard Build Variables

const config = {
  assets: {
    compressCss: true, // gzip and brotli compress CSS
    compressJavascript: true, // gzip and brotli compress JavaScript
    produceSourceMap: false // in production you probably want to disable
  },
  tie: {
    timeoutSecs: 20 // Timeout value for request to TIE
  },
  demoMode: true, // true = stores configs in local storage. In production it should be false
  /**
   * https://www.livechat.com/ integration - live chat handover
   */
  liveChatInc: {
    agentAssist: {
      /**
       * Server URL for creating agent assist canned responses -
       * https://github.com/jolzee/agent-assist-livechat-server-leopard
       */
      serverUrl: ""
    },
    key: "", // livechat.com license key
    /**
     * Create custom app "Leopard Chat UI" in
     * https://developers.livechat.com/console/apps/ and add an authorization
     * block.
     * Client Type: Web app
     * Client Id: copy and paste below
     * Add your URI whitelists for where Leopard is hosted
     * app scopes: Define your access scopes.
     *
     */
    clientId: ""
  },
  location: {
    /**
     * if you want to capture location information from the user then
     * provide a https://locationiq.com/ api key
     * https://jolzee.gitbook.io/leopard/configuration/response-options/field-types#location-information
     */
    locationIq: {
      key: ""
    },
    login: {
      /**
       * Capture and send geo location information at login.
       * Uses both https://ipapi.co/ip/ & http://www.geoplugin.net
       * This setting can be costly on first run.
       */
      sendAtLogin: false, // false = disabled, true = tries to obtain geo before greeting
      /**
       * Jaguar provides rest endpoint to proxy both the acquisition of the user's
       * IP and their geo location. This speeds up the whole process and deals with
       * any potential CORS issues.
       * https://github.com/jolzee/jaguar
       */
      serviceUrls: {
        geo: "", // https://my-jaguar.com/utils/geo
        ip: "" // https://my-jaguar.com/utils/ip
      }
    }
  },
  /**
   * Leopard can send debug information to both Log Rocket and Sentry.
   * If let absent nothing is sent.
   */
  logging: {
    logRocket: {
      key: "" // https://logrocket.com/
    },
    sentry: {
      key: "" // https://sentry.io/
    }
  },
  /**
   * Only applies when Leopard is embedded in production:
   * https://jolzee.gitbook.io/leopard/embedding
   */
  productionEmbed: {
    initialStateOpen: false, // should leopard automatically open on first load
    killSessionWhenClosed: false, // should the conversational session be closed when x is clicked
    showCloseButton: true, // allows you to hide the close button
    leopardTrustedDomains: [], // empty array = trust all domains // array of trusted domains - eg: ["https://my-domain.com", "https://my-other-domain.com"]
    enableScriptEval: false // this disabled the sending of JavaScript from Teneo Responses in production
  },
  /**
   * Social Authentication is provided through https://firebase.google.com/
   * Empty values signals no authentication
   */
  socialAuthentication: {
    firebase: {
      apiKey: "",
      authDomain: "",
      databaseUrl: "", // Firebase Realtime Database
      messagingSenderId: "",
      microsoft: {
        domainHint: "", // my-domain.com
        tenant: "" // Azure AD Tenant ID
      },
      projectId: "", // firebase project id
      providers: ["microsoft", "facebook", "google", "github"], // login and register will only show buttons for these providers
      storageBucket: ""
    }
  },
  solution: {
    location: {
      placeInStaticFolder: false, // false = loaded client side via JavaScript ; true = .env.solution.json is placed in /static/config.json
      sourceFile: ".env.solution.json" // relative path to your solution(s) config file - probably don't need to change
    }
  },
  tts: {
    url: "" // Jaguar URL if you plan to use AWS Polly instead of default Web Speech APIs TTS
  },
  ui: {
    configArea: {
      shareLink: {
        jaguarLinkShortenerUrl: "" // Optional - Use Jaguar's URL Shortener for https://tinyurl.com/ It can shortener shared links generated in the config area
      }
    },
    hideConfigMenu: false, // true = Set in production | false when in demo/development mode
    hideTeneoBranding: false // optionally hide Teneo Branding
  }
};

module.exports = config;

Important Notes on Some Variables

Environment Variable

Description

solution.location.placeInStaticFolder

If set to true then the build process will place copy the env.solution.jsonto/dist/static/config.json. It will then make an AJAX request to load in your solution(s) settings. If you add a .env.solution.json.token file adjacent to the .env.solution.json file then that token file will also be copied as /dist/static/config.json.token file after the build completes. This is useful for those that might need to perform variable substitution prior to deployment in tools such as Octopus Deploy.

If set to false then instead of making an ajax request to load the default solution config from the static directory the configuration file located in .env.solution.json is moved into a leopardConfig.*.js file in /dist/assets/js/

Last updated