@effectiv-ai/device-react-native
v1.0.4
Published
Effectiv Device SDK for React Native. Please visit our developer docs for detailed integration usage.
Downloads
4,074
Maintainers
Readme
@effectiv-ai/device-react-native
Effectiv Device SDK for React Native. Please visit our developer docs for detailed integration usage.
Installation
yarn add @effectiv-ai/device-react-native
Usage
Wrapping app with EffectivDeviceProvider
import React from 'react';
import { EffectivDeviceProvider } from '@effectiv-ai/device-react-native';
function App() {
<EffectivDeviceProvider apiKey="<your-api-key>" env="SANDBOX">
...
</EffectivDeviceProvider>;
}
Executing effectiv device SDK using the hook
import React from 'react';
import { useEffectivDevice } from '@effectiv-ai/device-react-native';
function Component() {
const { execute } = useEffectivDevice();
React.useEffect(() => {
const customerSessionID = '<customer-session-id>';
// or you can use `getSessionID` function provided by the useEffectivDevice hook for proxy session ID
// you can also generate new session ID by using `generateSessionID` function
execute({
customer_session_id: customerSessionID,
customer_user_id: '<customer-user-id>',
event: '<event-name>',
mode: 'LITE', // EXPERIMENTAL for beta features
}).then((response) => {
console.log('***EffectivDevice Response***:/n', response);
});
}, [execute]);
}
License
Paid License