Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This guide explains how to configure your Salesforce environment to use the LaunchDarkly JavaScript or React Web client-side SDKs in Lightning Web Components (LWCs). Salesforce Lightning Web Components are an implementation of standard web components that allow you to leverage HTML, CSS, and JavaScript in a lightweight framework. To learn more, read Introducing Lightning Web Components. The example code in this guide is extracted snippets. We show it here as if it is being used in a JavaScript class.Prerequisites
To complete this guide, you must have the following prerequisites:- Basic working knowledge of the LaunchDarkly JavaScript client-side SDK or React Web client-side SDK
- Basic working knowledge of Salesforce Lightning Web Components
Download the Launch
Darkly JavaScript ClientTo begin, find the latest version under Releases in the JavaScript SDK GitHub repository. Then download the desired version fromhttps://unpkg.com/launchdarkly-js-client-sdk@<VERSION>/dist/ldclient.min.js.
Set up your Salesforce environment
Next, set up your Salesforce environment. To do this:- Upload the file to your Salesforce organization as a static resource in your org
- Enable Lightning Web Security in your org
- Add
https://*.launchdarkly.comas a CSP Trusted Site, under Manage CSP Trusted Sites
Using the Launch
Darkly client in a Lightning Web ComponentIn the JavaScript file of your Lightning Web Component, import the static resource:getter method: