
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@brainfish-ai/widgets-initiator
Advanced tools
This package provides a simple way to integrate a Brainfish in-app widget in your website or web application. It supports the standard style, and slide-in popup.
npm install @branfish-ai/web-widget
<script type="module">
import Brainfish from "https://cdn.jsdelivr.net/npm/@brainfish-ai/web-widget@latest/dist/web.js"
Brainfish.Widgets.init({ widgetKey: "your-key" });
</script>
<button class="brainfish-trigger-button" onClick="Brainfish.HelpWidget.open('brainfish-trigger-button')">Help</button>
<!-- The widget will emit events when it opens and closes. You can listen to these events by adding the following code to your website: -->
<script>
// set up the abort controller
const controller = new AbortController();
// get the signal
const { signal } = controller;
// For close event: (onBrainfishHelpWidgetClosed)
window.addEventListener('onBrainfishHelpWidgetClosed', yourClosedHandlerFunction, { signal });
// For opened event: (onBrainfishHelpWidgetOpened)
window.addEventListener('onBrainfishHelpWidgetOpened', yourOpenedHandlerFunction, { signal });
</script>
<script>
// abort the event listeners when the widget is no longer needed
controller.abort();
</script>
Run the following command to build the widget:
yarn build:web-widget
To test the widget locally, you can use the following command:
cd packages/web-widget
npx serve ./ -p 8000 -C
You can test the widget locally by opening the test page in your browser. You can also pass in the env
parameter to test the widget in different environments. (local, staging, prod).
Note that they all point to the same web widget script run from your local server. (not the CDN). This provides a way to test the widget in different environments without having to deploy to the CDN.
open http://localhost:8000/test-pages/index.html?env=local
If you want to test the widget with the React app (react-search-widget), you can start the React app locally: (this will run on port 3006)
cd packages/react-search-widget
yarn dev
FAQs
Brainfish Widgets Manager
The npm package @brainfish-ai/widgets-initiator receives a total of 410 weekly downloads. As such, @brainfish-ai/widgets-initiator popularity was classified as not popular.
We found that @brainfish-ai/widgets-initiator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.