npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@extole/react-native-sdk

v1.0.18

Published

Extole React Native SDK

Downloads

3,896

Readme

Extole React Native SDK

This integration guide shows you how to set up and launch an Extole program as quickly as possible with our React Native SDK.

Requirements

The Extole React Native SDK supports iOS 13.0 or later and Android supports minSdkVersion 21 or later.

Install the SDK dependency

Add the extole-mobile-sdk dependency:

npm install @extole/react-native-sdk react-native-webview

Initialize SDK

Initialize Extole:

import {Extole} from '@extole/extole-mobile-sdk';


const extole = new Extole('share.client.com', 'your-app-name');

You’ll need to provide your Extole program domain in place of 'share.client.com'. Be sure to also replace 'your-app-name' with a descriptive name for your application.

Initialize View

In your code, pass configure the view and callback:

const [extoleView, setExtoleView] = React.useState<React.ReactNode>(<View />);

extole.configure(extoleView, setExtoleView, () => {
    navigation.navigate('Promo');
});

// Use the extole.view
function ExtoleScreen(): ReactElement {
  return return extole.view as ReactElement;
}

// The ExtoleScreen() method is used as a Screen
<Stack.Screen name='Promo' component={ExtoleScreen} />

By default, Extole will use this single view to interact with the customer.

Exchange Data with Extole

Customer Information

Send Extole information about the customer:

extole.identify("<[email protected]>", {"partner_user_id": "123"})

You can choose to pass any type of data to describe the customer. Richer data about your customers gives your marketing team the information they need to better segment your program participants and target them with appropriate campaigns.

Events

Send Extole events, such as registers, signups, conversions, account openings, etc:

extole.sendEvent("cta_viewed", {"key": "value"}))

For each event type, you can send additional data. For example, on a conversion event you may want to pass in order ID or order value and so on.

Call to Action Content

Populate a call to action (CTA) with content from Extole.

CTAs such as mobile menu items can be fully customized in the My Extole Campaign Editor. Each CTA has a designated zone. The following code is an example of how to retrieve a CTA by fetching zone content:

const [zone, setZone] = React.useState<Zone | null>(null);
React.useEffect(() => {
    extole
      .fetchZone('mobile_cta')
      .then(([zone, _campaign]) => {
        setZone(zone);
      });
}, []);

// On CTA tap send the event to Extole
const onShareButtonPress = () => {
  extole.sendEvent(cta?.touch_event, { extole_zone_name: 'microsite' });
};

. . . 

// Usage example:
<View style={styles.container}>
  <Image
    style={styles.tinyLogo}
    source={{
      uri: zone?.getData().image || '<default image link>',
    }}
  />
  <View style={styles.space} />
  <Button title={zone?.getData().title || ''} onPress={onShareButtonPress} />
  <View style={styles.space} />
</View>

In order to be able to fetch the cta zone, the zone should be configured in My Extole and should return JSON content containing the image and title.

Important note: We encourage you to pull CTA content from My Extole because doing so ensures that your menu item or overlay message will reflect the copy and offer you’ve configured for your campaign.

Advanced Usage

The following topics cover advanced use cases for the Extole React Native SDK. If you would like to explore any of these options, please reach out to our Support Team at [email protected].

Configuring Actions from Events

You can set up a specific action to occur when an event is fired. For example, when a customer taps on your menu item CTA, you may want the event to trigger an action that loads your microsite and shows the share experience.

To set up this type of configuration, you will need to work with Extole Support to set up a zone in My Extole that returns JSON configurations with conditions and actions. The SDK executes actions for conditions that are passing for a specific event:

{
  "operations": [
    {
      "conditions": [
        {
          "type": "EVENT",
          "event_names": [
            "cta_tap"
          ]
        }
      ],
      "actions": [
        {
          "type": "VIEW_FULLSCREEN",
          "zone_name": "microsite"
        }
      ]
    }
  ]
}

Supported Actions

The following types of actions are supported by default in our SDK.

Custom Actions

If you would like to create custom actions beyond our defaults, use the format exhibited in the example below. Please reach out to our Support Team at [email protected] if you have any questions.

Example custom action

export class CustomReactAction implements Action {
  type = 'CUSTOM';
  title = 'REACT_ACTION';

  execute(_event: AppEvent, _extole: Extole) {
    console.log('Custom Action was executed', this);
  }
}

Registering a custom action

extole.registerAction('CUSTOM', CustomReactAction.prototype);

Appendix

Advanced Actions

Load Operations

Loads additional operations

{
  "type": "LOAD_OPERATIONS",
  "zones": [
    "<zone_name>"
  ],
  "data": {
    "key": "value"
  }
}

Fetch

Fetches and caches content

{
  "type": "FETCH",
  "zones": [
    "<zone_name_1>",
    "<zone_name_2>"
  ]
}

Set Log Level

Used to configure the log level (DEBUG, INFO, WARN, ERROR)

{
  "type": "SET_LOG_LEVEL",
  "log_level": "WARN"
}