Description of your new file.
init()
every time a user visits my site?init()
once per page load, then call boot()
when the user is ready.shutdown()
before calling boot()
for a different user.
boot()
before calling init()
(NPM only)?init()
before boot()
.
boot()
multiple times in a session?shutdown()
first, then boot()
again.
boot()
before the widget container is rendered?<div id="adopt-widget-container"></div>
is in the DOM before calling boot()
.
shutdown()
. This will unmount the agent UI and clean up the session.
userId
is required. For guests, generate a temporary UUID for the session.
apiBaseUrl
in the boot()
call to match your current environment.
boot()
only in the browser (e.g. inside useEffect()
).
products
array in your boot()
call based on user or page context.
setCopilotHeaders()
to update headers when your token refreshes.
Script Example:
data-nonce
in script tags (for Script setup) or as a parameter in init()
(for NPM).
boot()
is called.