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

@zaiusinc/react-native-sdk

v1.2.0

Published

[Read more at our official documentation](http://docs.developers.zaius.com/react-native-sdk)

Downloads

3

Readme

Zaius React Native SDK

Read more at our official documentation

NPM Module

This page will take you through the steps to set up the Zaius SDK module in your React Native application.

The Zaius SDK module was written using TypeScript and so is fully compatible with both JavaScript and TypeScript applications. If you are developing a new React Native app and wish to integrate with Zaius, it's recommended you use TypeScript.react-native init Project --template typescript

npm install --save @zaiusinc/react-native-sdk @react-native-community/async-storage react-native-push-notification

iOS

For an iOS project you'll also need to run the following:

npm install --save @react-native-community/push-notification-ios
cd <project>/ios && pod install
react-native link

After this, you will need to allow your app's Bundle ID to have the Push Notifications capability (in Xcode, click on Capabilities and scroll down to Push Notifications).

Android

Inside <project>/android/app/src/main/AndroidManifest.xml, integrate the following XML to allow proper permissions to allow the app to manage Push Notifications.

<receiver
     android:name="com.google.android.gms.gcm.GcmReceiver"
     android:exported="true"
     android:permission="com.google.android.c2dm.permission.SEND" >
     <intent-filter>
         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
         <category android:name="${applicationId}" />
     </intent-filter>
 </receiver>
 <!-- < Only if you're using GCM or localNotificationSchedule() > -->

 <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
 <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
     <intent-filter>
         <action android:name="android.intent.action.BOOT_COMPLETED" />
     </intent-filter>
 </receiver>
 <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>

 <!-- < Only if you're using GCM or localNotificationSchedule() > -->
 <service
     android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
     android:exported="false" >
     <intent-filter>
         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
     </intent-filter>
 </service>
 <!-- </ Only if you're using GCM or localNotificationSchedule() > -->

 <!-- < Else > -->
 <service
     android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
     android:exported="false" >
     <intent-filter>
         <action android:name="com.google.firebase.MESSAGING_EVENT" />
     </intent-filter>
 </service>
 <!-- </Else> -->

You will also need to install your google-services.json according to Google's instructions. From the google-services.json file, you will need the project_number field, which you will use as the "Sender ID".

Initialize

In order to use the Zaius SDK, it must first be configured. You will need two required and one optional piece of information: First, you will need the Short Identifier from the Mobile Apps integration. This will be your App ID. Next, the API Key can be obtained from the "APIs" section in Zaius. Your API Key will be in the "key" field under "Public". Lastly, you will optionally need the Sender ID as mentioned above. This isn't required for iOS apps, but is required for Android apps.

With this information, you can use the main entry point for the SDK, Zaius.configure()

Zaius.configure({
    appId: string,
    apiKey: string,
    appVersion?: string = '',
    baseUrl?: string = 'https://api.zaius.com/v3',
    onNotification?: (notification: PushNotification) => void = () => undefined,
    onRegister?: (push_token: PushToken) => void = () => undefined,
    platform?: 'ios' | 'ios-sandbox' | 'android' | 'tvos' | 'tvos_sandbox' | 'unknown' // = [calculated from Platform.OS]
    requestPermissions?: boolean = true,
    senderID?: string = '',
    startQueue?: boolean = true,
}) : Promise<Zaius>

The arguments of configure are as follows:

  • appId: [Required] The App ID as mentioned above, the Shortened Name of your project.
  • apiKey: [Required] The API Key from the Public tab in the APIs section of the Zaius app.
  • appVersion: The version of your app, sent with each request to help you keep track of which customers are using which version.
  • baseUrl: Where the Zaius API is located. This should not normally by changed.
  • onNotification: A callback function that is called when a Push Notification is recieved by the app (Android) or tapped by the user (both Android and iOS). See Push Notifications for more information.
  • onRegister: A callback function that is called when permission for Push Notifications has been granted. Once this callback is called, everything is set up on the phone side for Pushes to work.
  • platform: Which platform the app is running on. Will be detected if it's not supplied.
  • requestPermissions: If this is false, then it is up to the app author to call Zaius.requestPermission() in order for Push Notifications to be initialized. See Push Notifications for more.
  • senderID: [Required for Android] Required for Push Notifications on Android. The Sender ID is found in the google-services.json file you can obtain this file from Firebase by following Google directions. The Sender ID is the value found at project_info -> project_number.
  • startQueue: When set to true, the SDK will start processing the Event queue as soon as it can. See Events for more information about the Event queue.

The return type of Zaius.configure is a Promise and so it must be handled as a Promise or called from an async function.

Once you have the Zaius object from configure() the following functions are available on both the object returned from Zaius.configure() and as functions directly on the global Zaius object (e.g. Zaius.customer()).

  • Zaius.getConfig(): Returns the configuration that the Zaius object is using.
  • Zaius.getVUID(): Return the VUID that identifies the current user. See VUIDs for more info.
  • Zaius.anonymize(): Generates a new VUID, effectively anonymizing the user.
  • Zaius.event(): Queues an event into the Event queue. See Events for more info.
  • Zaius.customer(): Updates information about this Customer with Zaius. See Customers for more info.
  • Zaius.identify(): Updates Customer identification information. See Customers for more info.