@wondeya/widget-loader
v0.1.0
Published
The vanilla loader that puts the wondeya widget on your site. No dependencies, under 5 KB.
Readme
@wondeya/widget-loader
The vanilla loader that puts the wondeya inline agent component on a website. No runtime dependencies, under 5 KB gzipped.
Most people never install this package — they paste the snippet (a container
div plus a script tag), which loads the same code from cdn.wondeya.com. See
the repo README for the snippet, the options, the
JavaScript API and the CSP guide.
Install it directly when you bundle the widget yourself:
npm install @wondeya/widget-loaderimport { createApi } from '@wondeya/widget-loader';
const api = createApi();
api.call('init', { agent: 'wdy_site_…', container: '#ask-our-agent' });Two builds ship, and they are not interchangeable:
dist/loader.js— the IIFE the CDN serves. It BOOTS on load: installswindow.wondeyaand auto-initializes from<script data-agent>;dist/index.js— ESM for bundlers. Exports everything, boots nothing.
import gives you the second one. A module with side effects on import would
mount an iframe the moment a bundler decided to evaluate it.
