@purered/pr1digitalad-react-native
v0.2.4
Published
React Native SDK that wraps an existing web experience inside a WebView.
Readme
@purered/pr1digitalad-react-native
React Native SDK that wraps PureRED DigitalAd.
Installation
yarn add @purered/pr1digitalad-react-native react-native-webviewPeer deps: react >= 18, react-native >= 0.72, react-native-webview >= 13.
Usage
import { DigitalAd } from '@purered/pr1digitalad-react-native';
export const Example = () => (
<DigitalAd
options={{
domain: "https://your-domain.com",
apiKey: "YOUR_API_KEY",
storeKey: "YOUR_STORE_KEY",
viewMode: "YOUR_VIEW_MODE",
environment: "PROD" // optional, defaults to "PROD"
}}
callbackHandler={(payload) => {
console.log('SDK event:', payload);
}}
/>
);Props
options(DigitalAdInput, required): Configuration object with the following properties:domain(string, required): The domain for the web experienceapiKey(string, required): Your API keystoreKey(string, required): Store identifierviewMode(string, optional): View mode configurationenvironment(string, optional): Environment setting, defaults to "PROD"cartItems(array, optional): Cart items dataclippedCoupons(array, optional): Clipped coupons datapayloadJsonString(string, optional): Additional payload data
callbackHandler(function, required): Callback function that receives events from the web experiencestyle(object, optional): Custom styling for the component container
Building
yarn install
yarn buildOutputs go to dist/ (run yarn build before publishing).
