Prepare your extension and install the web extension SDK into your browser extension.
alarms
storage
tabs
webRequest
scripting
permissions
array. Sleek runs CAA on every e-commerce page that the user interacts with. To do
so, Sleek requires the following host permissions:
@sleek/web-ext-sdk
package from Sleek’s private repo.
@sleek/web-ext-sdk
package. In addition, we recommend a setup where the
package repo URL is maintained by a .npmrc
file in the root of your project’s
directory.
@sleek/web-ext-sdk
in whatever fashion
best fits your needs. Use the private repo URL listed below and follow steps
for your package manager..npmrc
file in the root of your directory:
@sleek
scope (like our
@sleek/web-ext-sdk
) will be fetched from our private repo, when
installed and updated.
You should commit the resulting .npmrc
file, if you aren’t already, so that
your collaborators can use Sleek’s web extension SDK as well.
_authToken
field above is secured like any other
secret key in your organization.mf.js
.
The static scripts can be found in the downloaded web-ext-sdk package:
node_modules/@sleek/web-ext-sdk/dist/*
.
Copy the scripts into the root of your outputted and packaged web extension. We
recommend adding this step to your build pipeline. i.e. mf.js
should be in the
root of your extension, at the same level as your manifest.json
.
registerEventListener
:
registerEventListener
is typed, so if you are
calling with TypeScript, the event types are present in the package’s types and
the callback method will have data correctly typed as well. You can check
event
(seen above) against WebExtensionSdkEventType
to see what
event was emitted.