@getevy/js-sdk
v0.0.32
Published
The Javascript SDK to create and manage Evy components
Downloads
53
Readme
Evy SDK
Evy SDK is a vanilla JS / TS library that provides widgets for your Evy integration.
Evy is not meant to be used directly with frameworks or UI libraries (eg. React/Vue.js/Angular/Ember...). Instead, you should use Evy stately.
Installation
npm i @getevy/js-sdk
Alternatively, you can link the library in your HTML page, like that:
<head>
<script src="https://cdn.jsdelivr.net/npm/@getevy/js-sdk@latest/dist/bundle.js"></script>
...
</head>
Initialization
import { init as initEvySdk, components as evyComponents } from '@getevy/js-sdk';
const evySdk = initEvySdk({ apiKey: 'your_api_key' });
evySdk.addComponents([
evyComponents.inlineOffer({
container: '#inlineOffer-container',
product: 'my-product-id',
}),
]);
Configuration object
| Key | Required | Description |
| ------------ | ------------ | ------------------------------------------------------------ |
| apiKey | yes | your API key |
| apiURL | no | the URL of the API to target |
| operator | no | An object containing the name
and logoUrl
of the operator |
Components
cartOffer
Component to use in the cart to display the currently selected offer or add one there.
Parameters object
| Key | Required | Description | | ------------- | ------------ | ------------------------------------------------------------------------- | | container | yes | The selector of the container of the component (for example an empty div) | | product | yes | The product ID |
inlineOffer
Component to use in a product description page.
Parameters object
| Key | Required | Description | | ------------- | ------------ | ------------------------------------------------------------------------- | | container | yes | The selector of the container of the component (for example an empty div) | | product | yes | The product ID |
modalOffer
A variation of the inline offer with a modal.
Parameters object
| Key | Required | Description |
| ------------- | ------------ | ----------------------------------------------------------------------------------------- |
| product | yes | The product ID |
| modalType | no | The placement of the modal. Can be either left
, right
. center
. Defaults to center
|