0.0.32 • Published 2 years ago

@getevy/react-sdk v0.0.32

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Evy React SDK

Evy SDK is a react / TS library that provides widgets for your Evy integration.

Installation

npm i @getevy/react-sdk

Usage

Evy root

This widget creates a context that will provide information to the Evy components.

import { EvyRoot } from '@getevy/ui-react';
// other imports here

const API_KEY = process.env.REACT_APP_API_KEY;

if (!API_KEY) throw new Error('Evy API key is not set. Please check your environment.');

const rootDOM = document.getElementById('root');
const root = ReactDOM.createRoot(rootDOM);

root.render(
<EvyRoot apiKey={API_KEY}>
  {/* The rest of the application here */}
</EvyRoot>
);

Props:

  • apiKey: the API key to your store
  • children: the rest of the component tree
  • apiUrl: (optional) url to the evy API
  • language: (optional) country code
  • operator: (optional) object to customize the components with your brand. It has 2 keys
    • name: the name of the oeprator
    • logoUrl: a url to the logo of the operator

Components

CartOffer

import { CartOffer } from '@getevy/ui-react';

<CartOffer productId={productId} price={64000} />

Props:

  • productId: id of the product
  • price: current price of the product. When the price changes, this value has to change too.

InlineOffer

import { InlineOffer } from '@getevy/ui-react';

<InlineOffer productId={productId} price={64000}></InlineOffer>
```

Props:

- productId: id of the product
- price: current price of the product. When the price changes, this value has to change too.

** ModalOffer **

```Javascript
import { ModalOffer } from '@getevy/ui-react';
<ModalOffer
  productId={productId}
  price={64000}
  open={open}
  onClose={onCloseHandler}
></ModalOffer>

Props:

  • productId: id of the product
  • price: current price of the product. When the price changes, this value has to change too.

Hooks

useEvyContext

import { InlineOffer, ModalOffer, useEvyContext } from '@getevy/ui-react';

const { stately, evyState, operator } = useEvyContext();

Return values:

  • stately: the state management library
  • evyState: the current value of the state
  • oeprator: the operator configurator set in the root
0.0.32

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.19

2 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

2 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago