Getting Started
The Evy SDK is a complete set of UI components and helpers to build a complete Evy integration.
Browser support
The Evy SDK supports the next versions of the most popular browsers: Chrome(>=67), Firefox(>=60), Edge(>=17), Safari(>=11.1), and Internet Explorer (version 11 only).
To install the Evy Javascript client, you will have 2 possibilities:
Package manager installation
You can install the Evy SDK package using a package manager like npm or yarn.
npm install @getevy/js-sdk
yarn add @getevy/js-sdk
CDN installation
You need to inject its script on the page. There are two options to do that outlined below.
- You may do it directly in the page source code, we recommend you add this line in the
head
tag of your document. The operator will have the possibility to insert the JS Client script on the bottom of the <body> tag:
<head>
<script src="https://cdn.jsdelivr.net/npm/@getevy/js-sdk@latest/dist/bundle.js"></script>
...
</head>
For performance reasons, the operator can load the Javascript client script in an asynchronous way. It may create a slight flickering effect but will have a positive impact on the overall performance. For this need to add defer or async options while loading the script. Option choice depends on the client's needs.
<script src="https://cdn.jsdelivr.net/npm/@getevy/js-sdk@latest/dist/bundle.js" defer></script>
- The installation can be also done with the help of javascript:
const evySDKScript = document.createElement('script');
evySDKScript.src = 'https://cdn.jsdelivr.net/npm/@getevy/js-sdk@latest/dist/bundle.js';
document.head.appendChild(evySDKScript);
Once the Evy Javascript client is successfully loaded, an Evy object will be present in the global window scope of the webpage. You may verify the validity of the Evy object by executing window.Evy in your console. This will return a reference to the Evy Javascript client object.
Configure
Configuration should happen as early as possible in your application's lifecycle.
Once it's done, the Javascript SDK is ready for further actions: components rendering, accessing attached offers information,...
Evy.init({
/**
* Evy API key
*
* @required
**/
apiKey: string,
/**
* Desired host for the Evy API. For example: https://api.evy.eu/v1
*
* @optional
**/
apiUrl: string,
/**
* The language for offers locale. Default is french.
*
* @optional
**/
language: string,
/**
* Operator data to display on the UI components
*
* @optional
**/
operator: {
/**
* Operator name to display as alt for the operator logo
*
* @optional
**/
name: string,
/**
* The url of the operator logo to be used on components
*
* @required
**/
logoUrl: string,
},
links?: {
/**
* URL to the landing page of the program (optional)
*/
seeMoreLandingPageURL?: string,
/*
* URL to the privacy notice page of your program (optional)
*/
privacyNoticeURL?: string
}
});
Updated 9 days ago